Skip to content

Commit 96c1c0c

Browse files
Abel-WYPeter Zijlstra
authored andcommitted
sched/fair: Cleanup for SIS_PROP
The sched-domain of this cpu is only used for some heuristics when SIS_PROP is enabled, and it should be irrelevant whether the local sd_llc is valid or not, since all we care about is target sd_llc if !SIS_PROP. Access the local domain only when there is a need. Signed-off-by: Abel Wu <wuyun.abel@bytedance.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Mel Gorman <mgorman@suse.de> Link: https://lore.kernel.org/r/20220907112000.1854-6-wuyun.abel@bytedance.com
1 parent 398ba2b commit 96c1c0c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

kernel/sched/fair.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6396,19 +6396,19 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
63966396
struct sched_domain_shared *sd_share;
63976397
struct rq *this_rq = this_rq();
63986398
int this = smp_processor_id();
6399-
struct sched_domain *this_sd;
6399+
struct sched_domain *this_sd = NULL;
64006400
u64 time = 0;
64016401

6402-
this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
6403-
if (!this_sd)
6404-
return -1;
6405-
64066402
cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
64076403

64086404
if (sched_feat(SIS_PROP) && !has_idle_core) {
64096405
u64 avg_cost, avg_idle, span_avg;
64106406
unsigned long now = jiffies;
64116407

6408+
this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
6409+
if (!this_sd)
6410+
return -1;
6411+
64126412
/*
64136413
* If we're busy, the assumption that the last idle period
64146414
* predicts the future is flawed; age away the remaining
@@ -6462,7 +6462,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
64626462
if (has_idle_core)
64636463
set_idle_cores(target, false);
64646464

6465-
if (sched_feat(SIS_PROP) && !has_idle_core) {
6465+
if (sched_feat(SIS_PROP) && this_sd && !has_idle_core) {
64666466
time = cpu_clock(this) - time;
64676467

64686468
/*

0 commit comments

Comments
 (0)