diff options
author | Srikar Dronamraju <srikar@linux.vnet.ibm.com> | 2015-08-11 21:54:21 +0530 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-09-13 09:52:54 +0200 |
commit | 2a595721a1fa6b684c1c818f379bef834ac3d65e (patch) | |
tree | 36ad793dceb62bdefefb9ec58d0f98d017c61676 /kernel/sched/core.c | |
parent | 2b49d84b259fc18e131026e5d38e7855352f71b9 (diff) | |
download | lwn-2a595721a1fa6b684c1c818f379bef834ac3d65e.tar.gz lwn-2a595721a1fa6b684c1c818f379bef834ac3d65e.zip |
sched/numa: Convert sched_numa_balancing to a static_branch
Variable sched_numa_balancing toggles numa_balancing feature. Hence
moving from a simple read mostly variable to a more apt static_branch.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1439310261-16124-1-git-send-email-srikar@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index e0bd88b26a27..b62127118fc8 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2114,12 +2114,16 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) #endif /* CONFIG_NUMA_BALANCING */ } +DEFINE_STATIC_KEY_FALSE(sched_numa_balancing); + #ifdef CONFIG_NUMA_BALANCING -__read_mostly bool sched_numa_balancing; void set_numabalancing_state(bool enabled) { - sched_numa_balancing = enabled; + if (enabled) + static_branch_enable(&sched_numa_balancing); + else + static_branch_disable(&sched_numa_balancing); } #ifdef CONFIG_PROC_SYSCTL @@ -2128,7 +2132,7 @@ int sysctl_numa_balancing(struct ctl_table *table, int write, { struct ctl_table t; int err; - int state = sched_numa_balancing; + int state = static_branch_likely(&sched_numa_balancing); if (write && !capable(CAP_SYS_ADMIN)) return -EPERM; |