diff mbox

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

Message ID 1401800345-29468-1-git-send-email-daniel.lezcano@linaro.org
State New
Headers show

Commit Message

Daniel Lezcano June 3, 2014, 12:59 p.m. UTC
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.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 include/linux/sched.h |    7 -------
 kernel/sched/sched.h  |    7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Peter Zijlstra June 4, 2014, 8:02 a.m. UTC | #1
On Tue, Jun 03, 2014 at 02:59:05PM +0200, Daniel Lezcano wrote:
> 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!
Ingo Molnar June 5, 2014, 10:17 a.m. UTC | #2
* Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, Jun 03, 2014 at 02:59:05PM +0200, Daniel Lezcano wrote:
> > 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Daniel Lezcano June 5, 2014, 10:33 a.m. UTC | #3
On 06/05/2014 12:17 PM, Ingo Molnar wrote:
>
> * Peter Zijlstra <peterz@infradead.org> wrote:
>
>> On Tue, Jun 03, 2014 at 02:59:05PM +0200, Daniel Lezcano wrote:
>>> 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


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

I did not enabled CONFIG_SCHEDSTATS.

Sorry for the inconvenience.

   -- Daniel
Ingo Molnar June 5, 2014, 10:35 a.m. UTC | #4
* Daniel Lezcano <daniel.lezcano@linaro.org> wrote:

> On 06/05/2014 12:17 PM, Ingo Molnar wrote:
> >
> >* Peter Zijlstra <peterz@infradead.org> wrote:
> >
> >>On Tue, Jun 03, 2014 at 02:59:05PM +0200, Daniel Lezcano wrote:
> >>>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
> 
> 
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Daniel Lezcano June 5, 2014, 10:46 a.m. UTC | #5
On 06/05/2014 12:35 PM, Ingo Molnar wrote:
>
> * Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
>> On 06/05/2014 12:17 PM, Ingo Molnar wrote:
>>>
>>> * Peter Zijlstra <peterz@infradead.org> wrote:
>>>
>>>> On Tue, Jun 03, 2014 at 02:59:05PM +0200, Daniel Lezcano wrote:
>>>>> 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
>>
>>
>> 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.

Ok, I will look at it.

Thanks
   -- Daniel
diff mbox

Patch

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0f91d00..d561501 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -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
  */
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 600e229..118a859 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -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
  */