sched/core: Replace sd_busy/nr_busy_cpus with sched_domain_shared
Move the nr_busy_cpus thing from its hacky sd->parent->groups->sgc location into the much more natural sched_domain_shared location. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
24fc7edb92
commit
0e369d7575
@@ -8008,13 +8008,13 @@ static inline void set_cpu_sd_state_busy(void)
|
||||
int cpu = smp_processor_id();
|
||||
|
||||
rcu_read_lock();
|
||||
sd = rcu_dereference(per_cpu(sd_busy, cpu));
|
||||
sd = rcu_dereference(per_cpu(sd_llc, cpu));
|
||||
|
||||
if (!sd || !sd->nohz_idle)
|
||||
goto unlock;
|
||||
sd->nohz_idle = 0;
|
||||
|
||||
atomic_inc(&sd->groups->sgc->nr_busy_cpus);
|
||||
atomic_inc(&sd->shared->nr_busy_cpus);
|
||||
unlock:
|
||||
rcu_read_unlock();
|
||||
}
|
||||
@@ -8025,13 +8025,13 @@ void set_cpu_sd_state_idle(void)
|
||||
int cpu = smp_processor_id();
|
||||
|
||||
rcu_read_lock();
|
||||
sd = rcu_dereference(per_cpu(sd_busy, cpu));
|
||||
sd = rcu_dereference(per_cpu(sd_llc, cpu));
|
||||
|
||||
if (!sd || sd->nohz_idle)
|
||||
goto unlock;
|
||||
sd->nohz_idle = 1;
|
||||
|
||||
atomic_dec(&sd->groups->sgc->nr_busy_cpus);
|
||||
atomic_dec(&sd->shared->nr_busy_cpus);
|
||||
unlock:
|
||||
rcu_read_unlock();
|
||||
}
|
||||
@@ -8258,8 +8258,8 @@ end:
|
||||
static inline bool nohz_kick_needed(struct rq *rq)
|
||||
{
|
||||
unsigned long now = jiffies;
|
||||
struct sched_domain_shared *sds;
|
||||
struct sched_domain *sd;
|
||||
struct sched_group_capacity *sgc;
|
||||
int nr_busy, cpu = rq->cpu;
|
||||
bool kick = false;
|
||||
|
||||
@@ -8287,11 +8287,13 @@ static inline bool nohz_kick_needed(struct rq *rq)
|
||||
return true;
|
||||
|
||||
rcu_read_lock();
|
||||
sd = rcu_dereference(per_cpu(sd_busy, cpu));
|
||||
if (sd) {
|
||||
sgc = sd->groups->sgc;
|
||||
nr_busy = atomic_read(&sgc->nr_busy_cpus);
|
||||
|
||||
sds = rcu_dereference(per_cpu(sd_llc_shared, cpu));
|
||||
if (sds) {
|
||||
/*
|
||||
* XXX: write a coherent comment on why we do this.
|
||||
* See also: http://lkml.kernel.org/r/20111202010832.602203411@sbsiddha-desk.sc.intel.com
|
||||
*/
|
||||
nr_busy = atomic_read(&sds->nr_busy_cpus);
|
||||
if (nr_busy > 1) {
|
||||
kick = true;
|
||||
goto unlock;
|
||||
|
Reference in New Issue
Block a user