All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Hiding runqueues from direct refer at source code level
@ 2009-06-17 13:20 Hitoshi Mitake
  2009-06-17 15:03 ` [tip:sched/urgent] sched: Hide " tip-bot for Hitoshi Mitake
  2009-06-17 16:33 ` [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level tip-bot for Hitoshi Mitake
  0 siblings, 2 replies; 11+ messages in thread
From: Hitoshi Mitake @ 2009-06-17 13:20 UTC (permalink / raw)
  To: Ingo Molnar, linux-kernel



Hi,

I found a trivial problem in sched.c and sched_debug.c .
There are some points which refer the per-cpu value "runqueues" directly.
sched.c provides nice abstraction, such as cpu_rq() and this_rq(),
so we should use these macros when looking runqueues.

I fixed these points and made patch.
If there is a reason to refer runqueues directly, sorry,
this patch doesn't make sense.
But I think that someday the abstraction will help someone.

one-line description: Hiding runqueues from direct refer at source code level

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>

diff --git a/kernel/sched.c b/kernel/sched.c
index 8ec9d13..60dc315 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6625,7 +6625,7 @@ EXPORT_SYMBOL(yield);
  */
 void __sched io_schedule(void)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = this_rq();
 
 	delayacct_blkio_start();
 	atomic_inc(&rq->nr_iowait);
@@ -6637,7 +6637,7 @@ EXPORT_SYMBOL(io_schedule);
 
 long __sched io_schedule_timeout(long timeout)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = this_rq();
 	long ret;
 
 	delayacct_blkio_start();
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 467ca72..70c7e0b 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -162,7 +162,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
 	s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
 		spread, rq0_min_vruntime, spread0;
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 	struct sched_entity *last;
 	unsigned long flags;
 
@@ -191,7 +191,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	if (last)
 		max_vruntime = last->vruntime;
 	min_vruntime = cfs_rq->min_vruntime;
-	rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime;
+	rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
 	spin_unlock_irqrestore(&rq->lock, flags);
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "MIN_vruntime",
 			SPLIT_NS(MIN_vruntime));
@@ -248,7 +248,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 
 static void print_cpu(struct seq_file *m, int cpu)
 {
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 
 #ifdef CONFIG_X86
 	{

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

* [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-17 13:20 [PATCH] Hiding runqueues from direct refer at source code level Hitoshi Mitake
@ 2009-06-17 15:03 ` tip-bot for Hitoshi Mitake
  2009-06-17 16:31   ` Ingo Molnar
  2009-06-17 16:33 ` [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level tip-bot for Hitoshi Mitake
  1 sibling, 1 reply; 11+ messages in thread
From: tip-bot for Hitoshi Mitake @ 2009-06-17 15:03 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, mitake, tglx, mingo

Commit-ID:  d11ad9b3631b942b0d2e5b754a6c62158efb799f
Gitweb:     http://git.kernel.org/tip/d11ad9b3631b942b0d2e5b754a6c62158efb799f
Author:     Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
AuthorDate: Wed, 17 Jun 2009 22:20:55 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 17:02:38 +0200

sched: Hide runqueues from direct refer at source code level

There are some points which refer the per-cpu value "runqueues" directly.
sched.c provides nice abstraction, such as cpu_rq() and this_rq(),
so we should use these macros when looking runqueues.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
LKML-Reference: <20090617.222055.374768827975756908.mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/sched.c       |    4 ++--
 kernel/sched_debug.c |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 0056795..6240309 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6630,7 +6630,7 @@ EXPORT_SYMBOL(yield);
  */
 void __sched io_schedule(void)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = this_rq();
 
 	delayacct_blkio_start();
 	atomic_inc(&rq->nr_iowait);
@@ -6642,7 +6642,7 @@ EXPORT_SYMBOL(io_schedule);
 
 long __sched io_schedule_timeout(long timeout)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = this_rq();
 	long ret;
 
 	delayacct_blkio_start();
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 467ca72..70c7e0b 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -162,7 +162,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
 	s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
 		spread, rq0_min_vruntime, spread0;
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 	struct sched_entity *last;
 	unsigned long flags;
 
@@ -191,7 +191,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	if (last)
 		max_vruntime = last->vruntime;
 	min_vruntime = cfs_rq->min_vruntime;
-	rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime;
+	rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
 	spin_unlock_irqrestore(&rq->lock, flags);
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "MIN_vruntime",
 			SPLIT_NS(MIN_vruntime));
@@ -248,7 +248,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 
 static void print_cpu(struct seq_file *m, int cpu)
 {
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 
 #ifdef CONFIG_X86
 	{

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

* Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-17 15:03 ` [tip:sched/urgent] sched: Hide " tip-bot for Hitoshi Mitake
@ 2009-06-17 16:31   ` Ingo Molnar
  2009-06-18 10:14     ` Hitoshi Mitake
  0 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2009-06-17 16:31 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, mitake, tglx; +Cc: linux-tip-commits


* tip-bot for Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> wrote:

> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -6630,7 +6630,7 @@ EXPORT_SYMBOL(yield);
>   */
>  void __sched io_schedule(void)
>  {
> -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> +	struct rq *rq = this_rq();
>  
>  	delayacct_blkio_start();
>  	atomic_inc(&rq->nr_iowait);
> @@ -6642,7 +6642,7 @@ EXPORT_SYMBOL(io_schedule);
>  
>  long __sched io_schedule_timeout(long timeout)
>  {
> -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> +	struct rq *rq = this_rq();
>  	long ret;

I removed these two changes. Did you notice the __raw prefix?

	Ingo

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

* [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-17 13:20 [PATCH] Hiding runqueues from direct refer at source code level Hitoshi Mitake
  2009-06-17 15:03 ` [tip:sched/urgent] sched: Hide " tip-bot for Hitoshi Mitake
@ 2009-06-17 16:33 ` tip-bot for Hitoshi Mitake
  1 sibling, 0 replies; 11+ messages in thread
From: tip-bot for Hitoshi Mitake @ 2009-06-17 16:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, mitake, tglx, mingo

Commit-ID:  348ec61e6268c3cd7ee75cfa50e408184a941506
Gitweb:     http://git.kernel.org/tip/348ec61e6268c3cd7ee75cfa50e408184a941506
Author:     Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
AuthorDate: Wed, 17 Jun 2009 22:20:55 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 18:29:42 +0200

sched: Hide runqueues from direct refer at source code level

There are some points which refer the per-cpu value "runqueues" directly.
sched.c provides nice abstraction, such as cpu_rq() and this_rq(),
so we should use these macros when looking runqueues.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
LKML-Reference: <20090617.222055.374768827975756908.mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/sched_debug.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 467ca72..70c7e0b 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -162,7 +162,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
 	s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
 		spread, rq0_min_vruntime, spread0;
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 	struct sched_entity *last;
 	unsigned long flags;
 
@@ -191,7 +191,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	if (last)
 		max_vruntime = last->vruntime;
 	min_vruntime = cfs_rq->min_vruntime;
-	rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime;
+	rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
 	spin_unlock_irqrestore(&rq->lock, flags);
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "MIN_vruntime",
 			SPLIT_NS(MIN_vruntime));
@@ -248,7 +248,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 
 static void print_cpu(struct seq_file *m, int cpu)
 {
-	struct rq *rq = &per_cpu(runqueues, cpu);
+	struct rq *rq = cpu_rq(cpu);
 
 #ifdef CONFIG_X86
 	{

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

* Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-17 16:31   ` Ingo Molnar
@ 2009-06-18 10:14     ` Hitoshi Mitake
  2009-06-22 15:35       ` Ingo Molnar
  0 siblings, 1 reply; 11+ messages in thread
From: Hitoshi Mitake @ 2009-06-18 10:14 UTC (permalink / raw)
  To: mingo; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits

From: Ingo Molnar <mingo@elte.hu>
Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
Date: Wed, 17 Jun 2009 18:31:11 +0200

> ition: inline
> Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
> From: Ingo Molnar <mingo@elte.hu>
> To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
> 	mitake@dcl.info.waseda.ac.jp, tglx@linutronix.de
> Cc: linux-tip-commits@vger.kernel.org
> Date: Wed, 17 Jun 2009 18:31:11 +0200
> User-Agent: Mutt/1.5.18 (2008-05-17)
> Received-SPF: neutral (mx2.mail.elte.hu: 157.181.1.14 is neither permitted nor denied by domain of elte.hu) client-ip=157.181.1.14; envelope-from=mingo@elte.hu; helo=elvis.elte.hu;
> X-Mew: tab/spc characters on Subject: are simplified.
> 
> 
> * tip-bot for Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> wrote:
> 
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -6630,7 +6630,7 @@ EXPORT_SYMBOL(yield);
> >   */
> >  void __sched io_schedule(void)
> >  {
> > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > +	struct rq *rq = this_rq();
> >  
> >  	delayacct_blkio_start();
> >  	atomic_inc(&rq->nr_iowait);
> > @@ -6642,7 +6642,7 @@ EXPORT_SYMBOL(io_schedule);
> >  
> >  long __sched io_schedule_timeout(long timeout)
> >  {
> > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > +	struct rq *rq = this_rq();
> >  	long ret;
> 
> I removed these two changes. Did you notice the __raw prefix?
> 
> 	Ingo
> 

Thanks for your fix, I didn't notice...
I wrote a patch to fix these two points.

After applying this patch,
all direct reference to runqueues is in macros. How is this?

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>

diff --git a/kernel/sched.c b/kernel/sched.c
index 8ec9d13..e2ca8c1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
 #define this_rq()		(&__get_cpu_var(runqueues))
 #define task_rq(p)		cpu_rq(task_cpu(p))
 #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
+#define raw_rq()		(&__raw_get_cpu_var(runqueues))
 
 inline void update_rq_clock(struct rq *rq)
 {
@@ -6625,7 +6626,7 @@ EXPORT_SYMBOL(yield);
  */
 void __sched io_schedule(void)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = raw_rq();
 
 	delayacct_blkio_start();
 	atomic_inc(&rq->nr_iowait);
@@ -6637,7 +6638,7 @@ EXPORT_SYMBOL(io_schedule);
 
 long __sched io_schedule_timeout(long timeout)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = raw_rq();
 	long ret;
 
 	delayacct_blkio_start();

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

* Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-18 10:14     ` Hitoshi Mitake
@ 2009-06-22 15:35       ` Ingo Molnar
  2009-06-23  4:29         ` Hitoshi Mitake
  0 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2009-06-22 15:35 UTC (permalink / raw)
  To: Hitoshi Mitake; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits


* Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> wrote:

> From: Ingo Molnar <mingo@elte.hu>
> Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
> Date: Wed, 17 Jun 2009 18:31:11 +0200
> 
> > ition: inline
> > Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
> > From: Ingo Molnar <mingo@elte.hu>
> > To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
> > 	mitake@dcl.info.waseda.ac.jp, tglx@linutronix.de
> > Cc: linux-tip-commits@vger.kernel.org
> > Date: Wed, 17 Jun 2009 18:31:11 +0200
> > User-Agent: Mutt/1.5.18 (2008-05-17)
> > Received-SPF: neutral (mx2.mail.elte.hu: 157.181.1.14 is neither permitted nor denied by domain of elte.hu) client-ip=157.181.1.14; envelope-from=mingo@elte.hu; helo=elvis.elte.hu;
> > X-Mew: tab/spc characters on Subject: are simplified.
> > 
> > 
> > * tip-bot for Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> wrote:
> > 
> > > --- a/kernel/sched.c
> > > +++ b/kernel/sched.c
> > > @@ -6630,7 +6630,7 @@ EXPORT_SYMBOL(yield);
> > >   */
> > >  void __sched io_schedule(void)
> > >  {
> > > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > > +	struct rq *rq = this_rq();
> > >  
> > >  	delayacct_blkio_start();
> > >  	atomic_inc(&rq->nr_iowait);
> > > @@ -6642,7 +6642,7 @@ EXPORT_SYMBOL(io_schedule);
> > >  
> > >  long __sched io_schedule_timeout(long timeout)
> > >  {
> > > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > > +	struct rq *rq = this_rq();
> > >  	long ret;
> > 
> > I removed these two changes. Did you notice the __raw prefix?
> > 
> > 	Ingo
> > 
> 
> Thanks for your fix, I didn't notice...
> I wrote a patch to fix these two points.
> 
> After applying this patch,
> all direct reference to runqueues is in macros. How is this?
> 
> Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 8ec9d13..e2ca8c1 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
>  #define this_rq()		(&__get_cpu_var(runqueues))
>  #define task_rq(p)		cpu_rq(task_cpu(p))
>  #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
> +#define raw_rq()		(&__raw_get_cpu_var(runqueues))
>  
>  inline void update_rq_clock(struct rq *rq)
>  {
> @@ -6625,7 +6626,7 @@ EXPORT_SYMBOL(yield);
>   */
>  void __sched io_schedule(void)
>  {
> -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> +	struct rq *rq = raw_rq();
>  
>  	delayacct_blkio_start();
>  	atomic_inc(&rq->nr_iowait);
> @@ -6637,7 +6638,7 @@ EXPORT_SYMBOL(io_schedule);
>  
>  long __sched io_schedule_timeout(long timeout)
>  {
> -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> +	struct rq *rq = raw_rq();
>  	long ret;
>  
>  	delayacct_blkio_start();

Looks good - mind submitting a separate patch with a changelog, etc?

	Ingo

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

* Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-22 15:35       ` Ingo Molnar
@ 2009-06-23  4:29         ` Hitoshi Mitake
  2009-06-29  3:59           ` Hitoshi Mitake
  0 siblings, 1 reply; 11+ messages in thread
From: Hitoshi Mitake @ 2009-06-23  4:29 UTC (permalink / raw)
  To: mingo; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits

From: Ingo Molnar <mingo@elte.hu>
Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
Date: Mon, 22 Jun 2009 17:35:22 +0200

> > 
> > Thanks for your fix, I didn't notice...
> > I wrote a patch to fix these two points.
> > 
> > After applying this patch,
> > all direct reference to runqueues is in macros. How is this?
> > 
> > Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> > 
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index 8ec9d13..e2ca8c1 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
> >  #define this_rq()		(&__get_cpu_var(runqueues))
> >  #define task_rq(p)		cpu_rq(task_cpu(p))
> >  #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
> > +#define raw_rq()		(&__raw_get_cpu_var(runqueues))
> >  
> >  inline void update_rq_clock(struct rq *rq)
> >  {
> > @@ -6625,7 +6626,7 @@ EXPORT_SYMBOL(yield);
> >   */
> >  void __sched io_schedule(void)
> >  {
> > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > +	struct rq *rq = raw_rq();
> >  
> >  	delayacct_blkio_start();
> >  	atomic_inc(&rq->nr_iowait);
> > @@ -6637,7 +6638,7 @@ EXPORT_SYMBOL(io_schedule);
> >  
> >  long __sched io_schedule_timeout(long timeout)
> >  {
> > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > +	struct rq *rq = raw_rq();
> >  	long ret;
> >  
> >  	delayacct_blkio_start();
> 
> Looks good - mind submitting a separate patch with a changelog, etc?
> 
> 	Ingo
> 

No, I have no fix to post now. Thanks.


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

* Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-23  4:29         ` Hitoshi Mitake
@ 2009-06-29  3:59           ` Hitoshi Mitake
  2009-06-29  4:11             ` Ingo Molnar
  0 siblings, 1 reply; 11+ messages in thread
From: Hitoshi Mitake @ 2009-06-29  3:59 UTC (permalink / raw)
  To: mingo; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits

From: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
Date: Tue, 23 Jun 2009 13:29:20 +0900 (JST)

> From: Ingo Molnar <mingo@elte.hu>
> Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
> Date: Mon, 22 Jun 2009 17:35:22 +0200
> 
> > > 
> > > Thanks for your fix, I didn't notice...
> > > I wrote a patch to fix these two points.
> > > 
> > > After applying this patch,
> > > all direct reference to runqueues is in macros. How is this?
> > > 
> > > Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> > > 
> > > diff --git a/kernel/sched.c b/kernel/sched.c
> > > index 8ec9d13..e2ca8c1 100644
> > > --- a/kernel/sched.c
> > > +++ b/kernel/sched.c
> > > @@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
> > >  #define this_rq()		(&__get_cpu_var(runqueues))
> > >  #define task_rq(p)		cpu_rq(task_cpu(p))
> > >  #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
> > > +#define raw_rq()		(&__raw_get_cpu_var(runqueues))
> > >  
> > >  inline void update_rq_clock(struct rq *rq)
> > >  {
> > > @@ -6625,7 +6626,7 @@ EXPORT_SYMBOL(yield);
> > >   */
> > >  void __sched io_schedule(void)
> > >  {
> > > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > > +	struct rq *rq = raw_rq();
> > >  
> > >  	delayacct_blkio_start();
> > >  	atomic_inc(&rq->nr_iowait);
> > > @@ -6637,7 +6638,7 @@ EXPORT_SYMBOL(io_schedule);
> > >  
> > >  long __sched io_schedule_timeout(long timeout)
> > >  {
> > > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > > +	struct rq *rq = raw_rq();
> > >  	long ret;
> > >  
> > >  	delayacct_blkio_start();
> > 
> > Looks good - mind submitting a separate patch with a changelog, etc?
> > 
> > 	Ingo
> > 
> 
> No, I have no fix to post now. Thanks.
> 

I felt that I misunderstood what you said.
Are you requiring me a content for changelog?
Sorry for my poor English skill...

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

* Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
  2009-06-29  3:59           ` Hitoshi Mitake
@ 2009-06-29  4:11             ` Ingo Molnar
  2009-06-29  5:44               ` [PATCH] sched: Hide runqueues from direct refer at source code level for __raw_get_cpu_var() Hitoshi Mitake
  0 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2009-06-29  4:11 UTC (permalink / raw)
  To: Hitoshi Mitake; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits


* Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> wrote:

> From: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
> Date: Tue, 23 Jun 2009 13:29:20 +0900 (JST)
> 
> > From: Ingo Molnar <mingo@elte.hu>
> > Subject: Re: [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level
> > Date: Mon, 22 Jun 2009 17:35:22 +0200
> > 
> > > > 
> > > > Thanks for your fix, I didn't notice...
> > > > I wrote a patch to fix these two points.
> > > > 
> > > > After applying this patch,
> > > > all direct reference to runqueues is in macros. How is this?
> > > > 
> > > > Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> > > > 
> > > > diff --git a/kernel/sched.c b/kernel/sched.c
> > > > index 8ec9d13..e2ca8c1 100644
> > > > --- a/kernel/sched.c
> > > > +++ b/kernel/sched.c
> > > > @@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
> > > >  #define this_rq()		(&__get_cpu_var(runqueues))
> > > >  #define task_rq(p)		cpu_rq(task_cpu(p))
> > > >  #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
> > > > +#define raw_rq()		(&__raw_get_cpu_var(runqueues))
> > > >  
> > > >  inline void update_rq_clock(struct rq *rq)
> > > >  {
> > > > @@ -6625,7 +6626,7 @@ EXPORT_SYMBOL(yield);
> > > >   */
> > > >  void __sched io_schedule(void)
> > > >  {
> > > > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > > > +	struct rq *rq = raw_rq();
> > > >  
> > > >  	delayacct_blkio_start();
> > > >  	atomic_inc(&rq->nr_iowait);
> > > > @@ -6637,7 +6638,7 @@ EXPORT_SYMBOL(io_schedule);
> > > >  
> > > >  long __sched io_schedule_timeout(long timeout)
> > > >  {
> > > > -	struct rq *rq = &__raw_get_cpu_var(runqueues);
> > > > +	struct rq *rq = raw_rq();
> > > >  	long ret;
> > > >  
> > > >  	delayacct_blkio_start();
> > > 
> > > Looks good - mind submitting a separate patch with a changelog, etc?
> > > 
> > > 	Ingo
> > > 
> > 
> > No, I have no fix to post now. Thanks.
> > 
> 
> I felt that I misunderstood what you said.
> Are you requiring me a content for changelog?

Yes, please send a full patch with a new subject line and a 
changelog - as your previous patch has already been applied.

	Ingo

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

* [PATCH] sched: Hide runqueues from direct refer at source code level for __raw_get_cpu_var()
  2009-06-29  4:11             ` Ingo Molnar
@ 2009-06-29  5:44               ` Hitoshi Mitake
  2009-06-29  7:24                 ` [tip:sched/core] sched: Hide runqueues from direct reference " tip-bot for Hitoshi Mitake
  0 siblings, 1 reply; 11+ messages in thread
From: Hitoshi Mitake @ 2009-06-29  5:44 UTC (permalink / raw)
  To: mingo; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits


description:

My previous patch (Commit-ID of tip tree d11ad9b3631b942b0d2e5b754a6c62158efb799f) hides
direct refers at source code level into macros.
This will hide the rest part, __raw_get_cpu_var().
After appling this, all of the direct refer to runqueues will be in macros in the close place.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>

diff --git a/kernel/sched.c b/kernel/sched.c
index 7c9098d..d1d3599 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
 #define this_rq()		(&__get_cpu_var(runqueues))
 #define task_rq(p)		cpu_rq(task_cpu(p))
 #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
+#define raw_rq()		(&__raw_get_cpu_var(runqueues))
 
 inline void update_rq_clock(struct rq *rq)
 {
@@ -6631,7 +6632,7 @@ EXPORT_SYMBOL(yield);
  */
 void __sched io_schedule(void)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = raw_rq();
 
 	delayacct_blkio_start();
 	atomic_inc(&rq->nr_iowait);
@@ -6643,7 +6644,7 @@ EXPORT_SYMBOL(io_schedule);
 
 long __sched io_schedule_timeout(long timeout)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = raw_rq();
 	long ret;
 
 	delayacct_blkio_start();

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

* [tip:sched/core] sched: Hide runqueues from direct reference at source code level for __raw_get_cpu_var()
  2009-06-29  5:44               ` [PATCH] sched: Hide runqueues from direct refer at source code level for __raw_get_cpu_var() Hitoshi Mitake
@ 2009-06-29  7:24                 ` tip-bot for Hitoshi Mitake
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Hitoshi Mitake @ 2009-06-29  7:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, mitake, tglx, mingo

Commit-ID:  54d35f29f49224d86b994acb6e5969b9ba09022d
Gitweb:     http://git.kernel.org/tip/54d35f29f49224d86b994acb6e5969b9ba09022d
Author:     Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
AuthorDate: Mon, 29 Jun 2009 14:44:57 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 29 Jun 2009 09:19:27 +0200

sched: Hide runqueues from direct reference at source code level for __raw_get_cpu_var()

Hide __raw_get_cpu_var() as well - thus all the direct
references to runqueues will abstracted out.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
LKML-Reference: <20090629.144457.886429910353660979.mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/sched.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 168b268..ebc5151 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -692,6 +692,7 @@ static inline int cpu_of(struct rq *rq)
 #define this_rq()		(&__get_cpu_var(runqueues))
 #define task_rq(p)		cpu_rq(task_cpu(p))
 #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
+#define raw_rq()		(&__raw_get_cpu_var(runqueues))
 
 inline void update_rq_clock(struct rq *rq)
 {
@@ -6669,7 +6670,7 @@ EXPORT_SYMBOL(yield);
  */
 void __sched io_schedule(void)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = raw_rq();
 
 	delayacct_blkio_start();
 	atomic_inc(&rq->nr_iowait);
@@ -6681,7 +6682,7 @@ EXPORT_SYMBOL(io_schedule);
 
 long __sched io_schedule_timeout(long timeout)
 {
-	struct rq *rq = &__raw_get_cpu_var(runqueues);
+	struct rq *rq = raw_rq();
 	long ret;
 
 	delayacct_blkio_start();

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

end of thread, other threads:[~2009-06-29  7:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-17 13:20 [PATCH] Hiding runqueues from direct refer at source code level Hitoshi Mitake
2009-06-17 15:03 ` [tip:sched/urgent] sched: Hide " tip-bot for Hitoshi Mitake
2009-06-17 16:31   ` Ingo Molnar
2009-06-18 10:14     ` Hitoshi Mitake
2009-06-22 15:35       ` Ingo Molnar
2009-06-23  4:29         ` Hitoshi Mitake
2009-06-29  3:59           ` Hitoshi Mitake
2009-06-29  4:11             ` Ingo Molnar
2009-06-29  5:44               ` [PATCH] sched: Hide runqueues from direct refer at source code level for __raw_get_cpu_var() Hitoshi Mitake
2009-06-29  7:24                 ` [tip:sched/core] sched: Hide runqueues from direct reference " tip-bot for Hitoshi Mitake
2009-06-17 16:33 ` [tip:sched/urgent] sched: Hide runqueues from direct refer at source code level tip-bot for Hitoshi Mitake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.