sched/fair: cleanups and readability fixes
cover sched/fair: cleanups and readability fixes
This series contains two small cleanups in the CFS scheduler:
1. Fix misuse of the comma operator in NUMA fault accounting by replacing it with explicit statements, improving readability.
2. Replace bare 'unsigned' casts with explicit 'unsigned int' casts to comply with kernel coding style.
No functional changes intended.
Thanks,
Zhan Xusheng
Signature · 1 line
2.43.0
PATCH 1/2 sched/fair: fix comma operator misuse in NUMA fault accounting
Replace the comma operator with separate statements when assigning NUMA fault statistics. This improves readability and follows kernel coding style.
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -13957,7 +13957,7 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m) tpf = p->numa_faults[task_faults_idx (NUMA_MEM , node,1 )]; }if (ng) { - gsf = ng->faults[task_faults_idx (NUMA_MEM , node,0 )], + gsf = ng->faults[task_faults_idx (NUMA_MEM , node,0 )]; gpf = ng->faults[task_faults_idx (NUMA_MEM , node,1 )]; }print_numa_stats (m, node, tsf, tpf, gsf, gpf);
Signature · 1 line
2.43.0
Peter Zijlstra
maintainerRe: [PATCH 1/2] sched/fair: fix comma operator misuse in NUMA fault accounting
Quoted 3 lines · Zhan Xusheng
Replace the comma operator with separate statements when assigning NUMA fault statistics. This improves readability and follows kernel coding style.
This is the only one of the lot I would remotely consider applying. The rest is just noise. Please don't do style patches.
Quoted 22 lines
Signed-off-by Zhan Xusheng <[email protected]>--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/sched/fair.c +1
-1@@ -13957,7 +13957,7 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m) tpf = p->numa_faults[task_faults_idx (NUMA_MEM , node,1 )]; }if (ng) { - gsf = ng->faults[task_faults_idx (NUMA_MEM , node,0 )], + gsf = ng->faults[task_faults_idx (NUMA_MEM , node,0 )]; gpf = ng->faults[task_faults_idx (NUMA_MEM , node,1 )]; }print_numa_stats (m, node, tsf, tpf, gsf, gpf);Signature · 1 line
2.43.0
PATCH 2/2 sched/fair: replace bare 'unsigned' with 'unsigned int'
In reply to Zhan XushengReplace 'unsigned' casts with explicit 'unsigned int' casts to comply with kernel coding style.
No functional change intended.
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -7861,7 +7861,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)*/ if (sd) { i =select_idle_capacity (p, sd, target); -return ((unsigned )i < nr_cpumask_bits) ? i : target; +return ((unsigned int )i < nr_cpumask_bits) ? i : target; } }
@@ -7880,7 +7880,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) } i =select_idle_cpu (p, sd, has_idle_core, target); -if ((unsigned )i < nr_cpumask_bits) +if ((unsigned int )i < nr_cpumask_bits)return i;/*
Signature · 1 line
2.43.0