From 905f778dc295ad5d934fed6fd5f2742c2123dbcd Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 10 Jun 2015 19:38:18 -0300 Subject: [PATCH 2/7] pidstat: Add PF_NO_SETAFFINITY const For the stat flag that means that userland is not allowed to meddle with cpus_allowed, i.e. with the thread's smp affinity, via sched_setaffinity. This indeed has the same value as PF_THREAD_BOUND, see the kernel sources for an explanation, but basically was in this cset: commit 14a40ffccd6163bbcd1d6f32b28a88ffe6149fc6 Author: Tejun Heo Date: Tue Mar 19 13:45:20 2013 -0700 sched: replace PF_THREAD_BOUND with PF_NO_SETAFFINITY PF_THREAD_BOUND was originally used to mark kernel threads which were bound to a specific CPU using kthread_bind() and a task with the flag set allows cpus_allowed modifications only to itself. Workqueue is currently abusing it to prevent userland from meddling with cpus_allowed of workqueue workers. --------------------------------------------------------------- So add the new const but keep the old one, we may have some tool out there using it. Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: John Kacur --- procfs/procfs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/procfs/procfs.py b/procfs/procfs.py index 0dbf7f5b7da5..4ff7e9804bc9 100755 --- a/procfs/procfs.py +++ b/procfs/procfs.py @@ -2,7 +2,7 @@ # -*- python -*- # -*- coding: utf-8 -*- # -# Copyright (C) 2007 Red Hat, Inc. +# Copyright (C) 2007-2015 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -54,6 +54,7 @@ class pidstat: PF_SPREAD_PAGE = 0x01000000 PF_SPREAD_SLAB = 0x02000000 PF_THREAD_BOUND = 0x04000000 + PF_NO_SETAFFINITY = 0x04000000 # /* Userland is not allowed to meddle with cpus_allowed */ PF_MEMPOLICY = 0x10000000 PF_MUTEX_TESTER = 0x20000000 PF_FREEZER_SKIP = 0x40000000 -- 1.8.3.1