Skip to content

Commit c89d92e

Browse files
vireshkIngo Molnar
authored andcommitted
sched/fair: Use non-atomic cpumask_{set,clear}_cpu()
The cpumasks updated here are not subject to concurrency and using atomic bitops for them is pointless and expensive. Use the non-atomic variants instead. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vincent Guittot <vincent.guittot@linaro.org> Link: http://lkml.kernel.org/r/2e2a10f84b9049a81eef94ed6d5989447c21e34a.1549963617.git.viresh.kumar@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 1b5500d commit c89d92e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kernel/sched/fair.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6097,7 +6097,7 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int
60976097
bool idle = true;
60986098

60996099
for_each_cpu(cpu, cpu_smt_mask(core)) {
6100-
cpumask_clear_cpu(cpu, cpus);
6100+
__cpumask_clear_cpu(cpu, cpus);
61016101
if (!available_idle_cpu(cpu))
61026102
idle = false;
61036103
}
@@ -9105,7 +9105,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
91059105
if ((env.flags & LBF_DST_PINNED) && env.imbalance > 0) {
91069106

91079107
/* Prevent to re-select dst_cpu via env's CPUs */
9108-
cpumask_clear_cpu(env.dst_cpu, env.cpus);
9108+
__cpumask_clear_cpu(env.dst_cpu, env.cpus);
91099109

91109110
env.dst_rq = cpu_rq(env.new_dst_cpu);
91119111
env.dst_cpu = env.new_dst_cpu;
@@ -9132,7 +9132,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
91329132

91339133
/* All tasks on this runqueue were pinned by CPU affinity */
91349134
if (unlikely(env.flags & LBF_ALL_PINNED)) {
9135-
cpumask_clear_cpu(cpu_of(busiest), cpus);
9135+
__cpumask_clear_cpu(cpu_of(busiest), cpus);
91369136
/*
91379137
* Attempting to continue load balancing at the current
91389138
* sched_domain level only makes sense if there are

kernel/sched/isolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int __init housekeeping_setup(char *str, enum hk_flags flags)
8080
cpumask_andnot(housekeeping_mask,
8181
cpu_possible_mask, non_housekeeping_mask);
8282
if (cpumask_empty(housekeeping_mask))
83-
cpumask_set_cpu(smp_processor_id(), housekeeping_mask);
83+
__cpumask_set_cpu(smp_processor_id(), housekeeping_mask);
8484
} else {
8585
cpumask_var_t tmp;
8686

0 commit comments

Comments
 (0)