Skip to contentSkip to conversation

sched: Move sched_to_prio arrays out of line

PATCH In review Andi Kleen 4 participants 4 messages Nov 30, 2015 – Dec 4, 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.

v2: This version actually compiles. Sorry I forgot commit a fix up earlier.

---
 kernel/sched/auto_group.c |  2 +-
 kernel/sched/core.c       | 45 +++++++++++++++++++++++++++++++++++++++++++--
 kernel/sched/sched.h      | 42 ++----------------------------------------
 3 files changed, 46 insertions(+), 43 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 +43 -2

54 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
maintainer
#1 lore raw
Quoted 8 lines · Andi Kleen

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.

Yeah, that's not right.

Quoted 2 lines

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

Thanks!

#2 lore raw
Quoted 10 lines · Peter Zijlstra
Quoted 8 lines · Andi Kleen

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.

Quoted 6 lines

Yeah, that's not right.

Quoted 2 lines

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

Thanks!

Thanks. Please make sure the merge v2, v1 had one missing conversion.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only
#3 lore raw

[tip:sched/core] sched/core: Move the sched_to_prio[] arrays out of line

In reply to Andi Kleen
sched/core: Move the sched_to_prio[] arrays out of line
Commit-ID:  ed82b8a1ff76ed7b2709e36ed361ddd022fe2407
Gitweb:     http://git.kernel.org/tip/ed82b8a1ff76ed7b2709e36ed361ddd022fe2407
Author:     Andi Kleen <[email protected]>
AuthorDate: Sun, 29 Nov 2015 20:59:43 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 4 Dec 2015 10:34:46 +0100

sched/core: Move the sched_to_prio[] arrays out of line

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       | 45 +++++++++++++++++++++++++++++++++++++++++++--
 kernel/sched/sched.h      | 42 ++----------------------------------------
 3 files changed, 46 insertions(+), 43 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 +43 -2

54 lines not on this page · raw message

kernel/sched/sched.h +2 -40

48 lines not on this page · raw message