Skip to contentSkip to conversation

sched: Move sched_to_prio arrays out of line

PATCH New Andi Kleen 1 participant 1 message Nov 30, 2015 Scheduler

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 sched: Move sched_to_prio arrays out of line

From: Andi Kleen <[email protected]>

When building a kernel with a gcc 6 snapshot the compiler complains about unused const static variables for prio_to_weight and prio_to_mult for multiple scheduler files (all but core.c and autogroup.c)

The way the array is currently declared it will be duplicated in every scheduler file that includes sched.h, which seems rather wasteful.

Move the array out of line into core.c. I also added a sched_ prefix to avoid any potential name space collisions.

---
 kernel/sched/auto_group.c |  2 +-
 kernel/sched/core.c       | 43 ++++++++++++++++++++++++++++++++++++++++++-
 kernel/sched/sched.h      | 42 ++----------------------------------------
 3 files changed, 45 insertions(+), 42 deletions(-)
kernel/sched/auto_group.c +1 -1
index 750ed60..a5d966c 100644
@@ -212,7 +212,7 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice)
 	ag = autogroup_task_get(p);
 
 	down_write(&ag->lock);
-	err = sched_group_set_shares(ag->tg, prio_to_weight[nice + 20]);
+	err = sched_group_set_shares(ag->tg, sched_prio_to_weight[nice + 20]);
 	if (!err)
 		ag->nice = nice;
 	up_write(&ag->lock);
kernel/sched/core.c +42 -1

52 lines not on this page · raw message

kernel/sched/sched.h +2 -40

48 lines not on this page · raw message

Signature · 1 line
2.6.3