Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched: Pass 'struct rq' to nohz_idle_balance()

The cpu information is stored in the struct rq. Pass the struct rq to
nohz_idle_balance, so all the functions called in run_rebalance_domains have
the same parameters and the 'this_cpu' variable becomes pointless.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ Added !SMP build fix. ]
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1389008085-9069-8-git-send-email-daniel.lezcano@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Daniel Lezcano and committed by
Ingo Molnar
208cb16b f7ed0a89

+5 -6
+5 -6
kernel/sched/fair.c
··· 6740 6740 * In CONFIG_NO_HZ_COMMON case, the idle balance kickee will do the 6741 6741 * rebalancing for all the cpus for whom scheduler ticks are stopped. 6742 6742 */ 6743 - static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) 6743 + static void nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle) 6744 6744 { 6745 - struct rq *this_rq = cpu_rq(this_cpu); 6745 + int this_cpu = this_rq->cpu; 6746 6746 struct rq *rq; 6747 6747 int balance_cpu; 6748 6748 ··· 6844 6844 return 1; 6845 6845 } 6846 6846 #else 6847 - static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) { } 6847 + static void nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle) { } 6848 6848 #endif 6849 6849 6850 6850 /* ··· 6853 6853 */ 6854 6854 static void run_rebalance_domains(struct softirq_action *h) 6855 6855 { 6856 - int this_cpu = smp_processor_id(); 6857 - struct rq *this_rq = cpu_rq(this_cpu); 6856 + struct rq *this_rq = this_rq(); 6858 6857 enum cpu_idle_type idle = this_rq->idle_balance ? 6859 6858 CPU_IDLE : CPU_NOT_IDLE; 6860 6859 ··· 6864 6865 * balancing on behalf of the other idle cpus whose ticks are 6865 6866 * stopped. 6866 6867 */ 6867 - nohz_idle_balance(this_cpu, idle); 6868 + nohz_idle_balance(this_rq, idle); 6868 6869 } 6869 6870 6870 6871 static inline int on_null_domain(struct rq *rq)