Skip to contentSkip to conversation

sched: Move enum CPU_[xxx_]IDLE to private sched.h

PATCH In review Daniel Lezcano 3 participants 6 messages Jun 3, 2014 – Jun 5, 2014 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Move enum CPU_[xxx_]IDLE to private sched.h

The different enum CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE and CPU_MAX_IDLE_TYPES are only used in kernel/sched/fair.c and kernel/sched/stats.c.

Move their definitions in the private 'sched.h' file located in the same place than the files above.

---
 include/linux/sched.h |    7 -------
 kernel/sched/sched.h  |    7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/sched.h +0 -7
index 0f91d00..d561501 100644
@@ -846,13 +846,6 @@ static inline int sched_info_on(void)
 #endif
 }
 
-enum cpu_idle_type {
-	CPU_IDLE,
-	CPU_NOT_IDLE,
-	CPU_NEWLY_IDLE,
-	CPU_MAX_IDLE_TYPES
-};
-
 /*
  * Increase resolution of cpu_power calculations
  */
kernel/sched/sched.h +7 -0
index 600e229..118a859 100644
@@ -23,6 +23,13 @@ extern atomic_long_t calc_load_tasks;
 extern long calc_load_fold_active(struct rq *this_rq);
 extern void update_cpu_load_active(struct rq *this_rq);
 
+enum cpu_idle_type {
+	CPU_IDLE,
+	CPU_NOT_IDLE,
+	CPU_NEWLY_IDLE,
+	CPU_MAX_IDLE_TYPES
+};
+
 /*
  * Helpers for converting nanosecond timing to jiffy resolution
  */
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 7 lines · Daniel Lezcano

The different enum CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE and CPU_MAX_IDLE_TYPES are only used in kernel/sched/fair.c and kernel/sched/stats.c.

Move their definitions in the private 'sched.h' file located in the same place than the files above.

Thanks!

#2 lore raw
Quoted 10 lines · Peter Zijlstra
Quoted 7 lines · Daniel Lezcano

The different enum CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE and CPU_MAX_IDLE_TYPES are only used in kernel/sched/fair.c and kernel/sched/stats.c.

Move their definitions in the private 'sched.h' file located in the same place than the files above.

Thanks!

So this patch breaks x86 64-bit and 32-bit defconfigs:

In file included from /home/mingo/tip/arch/x86/kernel/asm-offsets.c:9:0:
/home/mingo/tip/include/linux/sched.h:939:24: error:
‘CPU_MAX_IDLE_TYPES’ undeclared here (not in a function)

  unsigned int lb_count[CPU_MAX_IDLE_TYPES];
                        ^

make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

Thanks,

Ingo

#3 lore raw
Quoted 21 lines · Ingo Molnar
Quoted 10 lines · Peter Zijlstra
Quoted 7 lines · Daniel Lezcano

The different enum CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE and CPU_MAX_IDLE_TYPES are only used in kernel/sched/fair.c and kernel/sched/stats.c.

Move their definitions in the private 'sched.h' file located in the same place than the files above.

Thanks!

So this patch breaks x86 64-bit and 32-bit defconfigs:

In file included from /home/mingo/tip/arch/x86/kernel/asm-offsets.c:9:0:
/home/mingo/tip/include/linux/sched.h:939:24: error:
‘CPU_MAX_IDLE_TYPES’ undeclared here (not in a function)

Quoted 5 lines
   unsigned int lb_count[CPU_MAX_IDLE_TYPES];
                         ^

make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

Gah ! That deserves -10 points to my karma :(

I did not enabled CONFIG_SCHEDSTATS.

Sorry for the inconvenience.

-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#4 lore raw
Quoted 29 lines · Daniel Lezcano
Quoted 21 lines · Ingo Molnar
Quoted 10 lines · Peter Zijlstra
Quoted 7 lines · Daniel Lezcano

The different enum CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE and CPU_MAX_IDLE_TYPES are only used in kernel/sched/fair.c and kernel/sched/stats.c.

Move their definitions in the private 'sched.h' file located in the same place than the files above.

Thanks!

So this patch breaks x86 64-bit and 32-bit defconfigs:

In file included from /home/mingo/tip/arch/x86/kernel/asm-offsets.c:9:0:
/home/mingo/tip/include/linux/sched.h:939:24: error:
‘CPU_MAX_IDLE_TYPES’ undeclared here (not in a function)

Quoted 5 lines
  unsigned int lb_count[CPU_MAX_IDLE_TYPES];
                        ^

make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

Quoted 5 lines

Gah ! That deserves -10 points to my karma :(

I did not enabled CONFIG_SCHEDSTATS.

Sorry for the inconvenience.

No problem. sched.h is a bit of a mess when it comes to data structure dependencies, due to all of 'struct task_struct' having to be defined by the time random kernel code references task->.

But this is about 'struct sched_domain', and I think we might be able to move that out of sched.h and into a separate header... In theory only scheduler internals (arch topology definitions and cores cheduler code) should know about it.

Thanks,

Ingo

#5 lore raw
Quoted 38 lines · Ingo Molnar
Quoted 29 lines · Daniel Lezcano
Quoted 21 lines · Ingo Molnar
Quoted 10 lines · Peter Zijlstra
Quoted 7 lines · Daniel Lezcano

The different enum CPU_IDLE, CPU_NOT_IDLE, CPU_NEWLY_IDLE and CPU_MAX_IDLE_TYPES are only used in kernel/sched/fair.c and kernel/sched/stats.c.

Move their definitions in the private 'sched.h' file located in the same place than the files above.

Thanks!

So this patch breaks x86 64-bit and 32-bit defconfigs:

In file included from /home/mingo/tip/arch/x86/kernel/asm-offsets.c:9:0:
/home/mingo/tip/include/linux/sched.h:939:24: error:
‘CPU_MAX_IDLE_TYPES’ undeclared here (not in a function)

Quoted 5 lines
   unsigned int lb_count[CPU_MAX_IDLE_TYPES];
                         ^

make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

Quoted 5 lines

Gah ! That deserves -10 points to my karma :(

I did not enabled CONFIG_SCHEDSTATS.

Sorry for the inconvenience.

Quoted 8 lines

No problem. sched.h is a bit of a mess when it comes to data structure dependencies, due to all of 'struct task_struct' having to be defined by the time random kernel code references task->.

But this is about 'struct sched_domain', and I think we might be able to move that out of sched.h and into a separate header... In theory only scheduler internals (arch topology definitions and cores cheduler code) should know about it.

Ok, I will look at it.

Thanks
-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog