public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Use proper type for runqueue's idle_at_tick.
@ 2011-04-29 18:01 Rakib Mullick
  2011-04-30  7:16 ` [tip:sched/core] sched: Use bool type for rq->idle_at_tick tip-bot for Rakib Mullick
  0 siblings, 1 reply; 4+ messages in thread
From: Rakib Mullick @ 2011-04-29 18:01 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel

 Searching over scheduler code for uses of idle_at_tick, tells that its been used for making TRUE/FALSE decision. But, its been declared as 'unsigned char', using 'bool' is more rational here. So, for consistency use 'bool' as idle_at_tick type instead of 'unsigned char'.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---

diff --git a/kernel/sched.c b/kernel/sched.c
index 8cb0a57..d9f7f98 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -505,7 +505,7 @@ struct rq {
 
 	unsigned long cpu_power;
 
-	unsigned char idle_at_tick;
+	bool idle_at_tick;
 	/* For active balancing */
 	int post_schedule;
 	int active_balance;



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip:sched/core] sched: Use bool type for rq->idle_at_tick
  2011-04-29 18:01 [PATCH] sched: Use proper type for runqueue's idle_at_tick Rakib Mullick
@ 2011-04-30  7:16 ` tip-bot for Rakib Mullick
  2011-05-11 11:08   ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: tip-bot for Rakib Mullick @ 2011-04-30  7:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, rakib.mullick, peterz, tglx, mingo

Commit-ID:  eea502ffd4aeef233b5eadbde405a9df92d57a5e
Gitweb:     http://git.kernel.org/tip/eea502ffd4aeef233b5eadbde405a9df92d57a5e
Author:     Rakib Mullick <rakib.mullick@gmail.com>
AuthorDate: Sat, 30 Apr 2011 00:01:02 +0600
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 30 Apr 2011 00:17:14 +0200

sched: Use bool type for rq->idle_at_tick

Searching over the scheduler code for uses of rq->idle_at_tick
shows us that it's used for making TRUE/FALSE decision.

Still its type is 'unsigned char' so using 'bool' would be
cleaner.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1304100062.19359.6.camel@localhost.localdomain
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index f11a2a5..a492209 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -505,7 +505,7 @@ struct rq {
 
 	unsigned long cpu_power;
 
-	unsigned char idle_at_tick;
+	bool idle_at_tick;
 	/* For active balancing */
 	int post_schedule;
 	int active_balance;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [tip:sched/core] sched: Use bool type for rq->idle_at_tick
  2011-04-30  7:16 ` [tip:sched/core] sched: Use bool type for rq->idle_at_tick tip-bot for Rakib Mullick
@ 2011-05-11 11:08   ` Peter Zijlstra
  2011-05-11 11:19     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2011-05-11 11:08 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, rakib.mullick, tglx, mingo; +Cc: linux-tip-commits

On Sat, 2011-04-30 at 07:16 +0000, tip-bot for Rakib Mullick wrote:
> Commit-ID:  eea502ffd4aeef233b5eadbde405a9df92d57a5e
> Gitweb:     http://git.kernel.org/tip/eea502ffd4aeef233b5eadbde405a9df92d57a5e
> Author:     Rakib Mullick <rakib.mullick@gmail.com>
> AuthorDate: Sat, 30 Apr 2011 00:01:02 +0600
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 30 Apr 2011 00:17:14 +0200
> 
> sched: Use bool type for rq->idle_at_tick
> 
> Searching over the scheduler code for uses of rq->idle_at_tick
> shows us that it's used for making TRUE/FALSE decision.
> 
> Still its type is 'unsigned char' so using 'bool' would be
> cleaner.
> 
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Link: http://lkml.kernel.org/r/1304100062.19359.6.camel@localhost.localdomain
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  kernel/sched.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index f11a2a5..a492209 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -505,7 +505,7 @@ struct rq {
>  
>  	unsigned long cpu_power;
>  
> -	unsigned char idle_at_tick;
> +	bool idle_at_tick;
>  	/* For active balancing */
>  	int post_schedule;
>  	int active_balance;

Right, so the problem I have with using bool in structures is that
sizeof(_Bool) is not well defined by the C standard and is
implementation dependent, meaning the struct rq layout can change
between gcc versions, architectures or even between optimization levels.

So for structures where the layout is relevant we must avoid bool.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tip:sched/core] sched: Use bool type for rq->idle_at_tick
  2011-05-11 11:08   ` Peter Zijlstra
@ 2011-05-11 11:19     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2011-05-11 11:19 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, linux-kernel, rakib.mullick, tglx, linux-tip-commits


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Sat, 2011-04-30 at 07:16 +0000, tip-bot for Rakib Mullick wrote:
> > Commit-ID:  eea502ffd4aeef233b5eadbde405a9df92d57a5e
> > Gitweb:     http://git.kernel.org/tip/eea502ffd4aeef233b5eadbde405a9df92d57a5e
> > Author:     Rakib Mullick <rakib.mullick@gmail.com>
> > AuthorDate: Sat, 30 Apr 2011 00:01:02 +0600
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 30 Apr 2011 00:17:14 +0200
> > 
> > sched: Use bool type for rq->idle_at_tick
> > 
> > Searching over the scheduler code for uses of rq->idle_at_tick
> > shows us that it's used for making TRUE/FALSE decision.
> > 
> > Still its type is 'unsigned char' so using 'bool' would be
> > cleaner.
> > 
> > Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Link: http://lkml.kernel.org/r/1304100062.19359.6.camel@localhost.localdomain
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > ---
> >  kernel/sched.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index f11a2a5..a492209 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -505,7 +505,7 @@ struct rq {
> >  
> >  	unsigned long cpu_power;
> >  
> > -	unsigned char idle_at_tick;
> > +	bool idle_at_tick;
> >  	/* For active balancing */
> >  	int post_schedule;
> >  	int active_balance;
> 
> Right, so the problem I have with using bool in structures is that
> sizeof(_Bool) is not well defined by the C standard and is
> implementation dependent, meaning the struct rq layout can change
> between gcc versions, architectures or even between optimization levels.
> 
> So for structures where the layout is relevant we must avoid bool.

Okay, zapped it stays then.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-11 17:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29 18:01 [PATCH] sched: Use proper type for runqueue's idle_at_tick Rakib Mullick
2011-04-30  7:16 ` [tip:sched/core] sched: Use bool type for rq->idle_at_tick tip-bot for Rakib Mullick
2011-05-11 11:08   ` Peter Zijlstra
2011-05-11 11:19     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox