Skip to contentSkip to conversation

sched: Remove never used code in mm_cid_get()

PATCH In review Andy Shevchenko 4 participants 6 messages Oct 15, 2025 – Oct 24, 2025 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Remove never used code in mm_cid_get()

Clang is not happy with set but unused variable (this is visible with make W=1 build:

kernel/sched/sched.h:3744:18: error: variable 'cpumask' set but not used [-Werror,-Wunused-but-set-variable]

It seems like the variable was never be used along with the assignment that does not have side effects as far as I can see. Remove those altogether.

Fixes 223baf9d17f2 ("sched: Fix performance regression introduced by mm_cid")
---
 kernel/sched/sched.h | 2 --
 1 file changed, 2 deletions(-)
kernel/sched/sched.h +0 -2
index 1f5d07067f60..361f9101cef9 100644
@@ -3740,11 +3740,9 @@ static inline int mm_cid_get(struct rq *rq, struct task_struct *t,
 			     struct mm_struct *mm)
 {
 	struct mm_cid __percpu *pcpu_cid = mm->pcpu_cid;
-	struct cpumask *cpumask;
 	int cid;
 
 	lockdep_assert_rq_held(rq);
-	cpumask = mm_cidmask(mm);
 	cid = __this_cpu_read(pcpu_cid->cid);
 	if (mm_cid_is_valid(cid)) {
 		mm_cid_snapshot_time(rq, mm);
Signature · 1 line
2.50.1
#1 lore raw
Quoted 7 lines · Andy Shevchenko

Clang is not happy with set but unused variable (this is visible with make W=1 build:

kernel/sched/sched.h:3744:18: error: variable 'cpumask' set but not used [-Werror,-Wunused-but-set-variable]

It seems like the variable was never be used along with the assignment that does not have side effects as far as I can see. Remove those altogether.

Anybody to apply this for fixes?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 7 lines · Andy Shevchenko

Clang is not happy with set but unused variable (this is visible with make W=1 build:

kernel/sched/sched.h:3744:18: error: variable 'cpumask' set but not used [-Werror,-Wunused-but-set-variable]

It seems like the variable was never be used along with the assignment that does not have side effects as far as I can see. Remove those altogether.

Anybody to apply this for fixes?

Why? W=1 and WERROR is very much you get to keep the pieces land, no?

#3 lore raw
Quoted 5 lines · Peter Zijlstra
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

Clang is not happy with set but unused variable (this is visible with make W=1 build:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

kernel/sched/sched.h:3744:18: error: variable 'cpumask' set but not used [-Werror,-Wunused-but-set-variable]

It seems like the variable was never be used along with the assignment that does not have side effects as far as I can see. Remove those altogether.

Anybody to apply this for fixes?

Why? W=1 and WERROR is very much you get to keep the pieces land, no?

The builds I have almost W=1 clean, I have only a couple of patches which I try to push forward (already for a few releases). Your patch to move static inline unused function warning to level 2 would drop them, leaving the above the only culprit so far.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Tested-by
#4 lore raw
In reply to Peter Zijlstra
Quoted 5 lines · Peter Zijlstra
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

Clang is not happy with set but unused variable (this is visible with make W=1 build:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

kernel/sched/sched.h:3744:18: error: variable 'cpumask' set but not used [-Werror,-Wunused-but-set-variable]

It seems like the variable was never be used along with the assignment that does not have side effects as far as I can see. Remove those altogether.

Anybody to apply this for fixes?

Why? W=1 and WERROR is very much you get to keep the pieces land, no?

Linus, could you consider applying this directly? This seems to have broken W=1 for basically the whole kernel. I see many other people already ran into this and sent the same patch
(https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected])
but unfortunately the maintainer is refusing to apply any of them.

I find W=1 to be useful, and I keep my subsystems W=1 clean. But I cannot do that if W=1 is broken for all kernel builds.

I think it's clear that a lot of other people find it useful too.

- Eric

#5 lore raw
Quoted 2 lines · Eric Biggers

Linus, could you consider applying this directly?

Done.

Linus