Skip to content

Commit 7f434df

Browse files
kudureranganathPeter Zijlstra
authored andcommitted
sched/topology: Remove redundant variable and fix incorrect type in build_sched_domains
While investigating the sparse warning reported by the LKP bot [1], observed that we have a redundant variable "top" in the function build_sched_domains that was introduced in the recent commit e496132 ("sched/fair: Adjust the allowed NUMA imbalance when SD_NUMA spans multiple LLCs") The existing variable "sd" suffices which allows us to remove the redundant variable "top" while annotating the other variable "top_p" with the "__rcu" annotation to silence the sparse warning. [1] https://lore.kernel.org/lkml/202202170853.9vofgC3O-lkp@intel.com/ Fixes: e496132 ("sched/fair: Adjust the allowed NUMA imbalance when SD_NUMA spans multiple LLCs") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Valentin Schneider <valentin.schneider@arm.com> Link: https://lore.kernel.org/r/20220218162743.1134-1-kprateek.nayak@amd.com
1 parent 821aecd commit 7f434df

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

kernel/sched/topology.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,7 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
22912291

22922292
if (!(sd->flags & SD_SHARE_PKG_RESOURCES) && child &&
22932293
(child->flags & SD_SHARE_PKG_RESOURCES)) {
2294-
struct sched_domain *top, *top_p;
2294+
struct sched_domain __rcu *top_p;
22952295
unsigned int nr_llcs;
22962296

22972297
/*
@@ -2316,11 +2316,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
23162316
sd->imb_numa_nr = imb;
23172317

23182318
/* Set span based on the first NUMA domain. */
2319-
top = sd;
2320-
top_p = top->parent;
2319+
top_p = sd->parent;
23212320
while (top_p && !(top_p->flags & SD_NUMA)) {
2322-
top = top->parent;
2323-
top_p = top->parent;
2321+
top_p = top_p->parent;
23242322
}
23252323
imb_span = top_p ? top_p->span_weight : sd->span_weight;
23262324
} else {

0 commit comments

Comments
 (0)