linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: At sched_fork use __set_task_cpu().
@ 2012-01-29 16:34 Rakib Mullick
  2012-01-31  8:48 ` Kamalesh Babulal
  0 siblings, 1 reply; 4+ messages in thread
From: Rakib Mullick @ 2012-01-29 16:34 UTC (permalink / raw)
  To: mingo, a.p.zijlstra; +Cc: linux-kernel

 We don't use select_task_rq() from sched_fork() anymore and no chance of task gets migrated at
this point. Therefore, we can avoid task migration related checking/accounting, so use
__set_task_cpu() instead of set_task_cpu().

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

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index df00cb0..a38026e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1755,7 +1755,7 @@ void sched_fork(struct task_struct *p)
 	 * Silence PROVE_RCU.
 	 */
 	raw_spin_lock_irqsave(&p->pi_lock, flags);
-	set_task_cpu(p, cpu);
+	__set_task_cpu(p, cpu);
 	raw_spin_unlock_irqrestore(&p->pi_lock, flags);
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)



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

* Re: [PATCH] sched: At sched_fork use __set_task_cpu().
  2012-01-29 16:34 [PATCH] sched: At sched_fork use __set_task_cpu() Rakib Mullick
@ 2012-01-31  8:48 ` Kamalesh Babulal
  2012-02-01 13:55   ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Kamalesh Babulal @ 2012-01-31  8:48 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: mingo, a.p.zijlstra, linux-kernel

* Rakib Mullick <rakib.mullick@gmail.com> [2012-01-29 22:34:37]:

>  We don't use select_task_rq() from sched_fork() anymore and no chance of task gets migrated at
> this point. Therefore, we can avoid task migration related checking/accounting, so use
> __set_task_cpu() instead of set_task_cpu().
> 
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
  Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
> ---
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index df00cb0..a38026e 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1755,7 +1755,7 @@ void sched_fork(struct task_struct *p)
>  	 * Silence PROVE_RCU.
>  	 */
>  	raw_spin_lock_irqsave(&p->pi_lock, flags);
> -	set_task_cpu(p, cpu);
> +	__set_task_cpu(p, cpu);
>  	raw_spin_unlock_irqrestore(&p->pi_lock, flags);
> 
>  #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
> 
> 
> --


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

* Re: [PATCH] sched: At sched_fork use __set_task_cpu().
  2012-01-31  8:48 ` Kamalesh Babulal
@ 2012-02-01 13:55   ` Peter Zijlstra
  2012-02-01 17:07     ` Rakib Mullick
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2012-02-01 13:55 UTC (permalink / raw)
  To: Kamalesh Babulal; +Cc: Rakib Mullick, mingo, linux-kernel

On Tue, 2012-01-31 at 14:18 +0530, Kamalesh Babulal wrote:
> * Rakib Mullick <rakib.mullick@gmail.com> [2012-01-29 22:34:37]:
> 
> >  We don't use select_task_rq() from sched_fork() anymore and no chance of task gets migrated at
> > this point. Therefore, we can avoid task migration related checking/accounting, so use
> > __set_task_cpu() instead of set_task_cpu().
> > 
> > Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
>   Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>

Since we call sched_fork() with preemption enabled _long_ after the
child is copied from the parent who is to say we (parent) didn't migrate
away and are now setting a different cpu?

One could argue that that might not be a real migration from the child's
POV, maybe, but nobody seems to be making that argument.

I really don't see the point of this..

> > ---
> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index df00cb0..a38026e 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -1755,7 +1755,7 @@ void sched_fork(struct task_struct *p)
> >  	 * Silence PROVE_RCU.
> >  	 */
> >  	raw_spin_lock_irqsave(&p->pi_lock, flags);
> > -	set_task_cpu(p, cpu);
> > +	__set_task_cpu(p, cpu);
> >  	raw_spin_unlock_irqrestore(&p->pi_lock, flags);
> > 
> >  #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
> > 
> > 
> > --
> 




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

* Re: [PATCH] sched: At sched_fork use __set_task_cpu().
  2012-02-01 13:55   ` Peter Zijlstra
@ 2012-02-01 17:07     ` Rakib Mullick
  0 siblings, 0 replies; 4+ messages in thread
From: Rakib Mullick @ 2012-02-01 17:07 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Kamalesh Babulal, mingo, linux-kernel

On Wed, Feb 1, 2012 at 7:55 PM, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> On Tue, 2012-01-31 at 14:18 +0530, Kamalesh Babulal wrote:
>> * Rakib Mullick <rakib.mullick@gmail.com> [2012-01-29 22:34:37]:
>>
>> >  We don't use select_task_rq() from sched_fork() anymore and no chance of task gets migrated at
>> > this point. Therefore, we can avoid task migration related checking/accounting, so use
>> > __set_task_cpu() instead of set_task_cpu().
>> >
>> > Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
>>   Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
>
> Since we call sched_fork() with preemption enabled _long_ after the
> child is copied from the parent who is to say we (parent) didn't migrate
> away and are now setting a different cpu?
>
If parent gets migrated that should be accounted as parents migration
count not for child offcourse. And if we're counting child's
nr_migration count for parent's getting migrated, we're simply
screwing childs migration count. Isn't it?

> One could argue that that might not be a real migration from the child's
> POV, maybe, but nobody seems to be making that argument.
>
But I'm not seeing it from child's or parent's POV. I'm simply
addressing the point of a task's migration counter
(p->se.nr_migrations), simply this task wasn't moved.

> I really don't see the point of this..
>
I'm hoping, you'll rethink...

Thanks,
Rakib

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

end of thread, other threads:[~2012-02-01 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 16:34 [PATCH] sched: At sched_fork use __set_task_cpu() Rakib Mullick
2012-01-31  8:48 ` Kamalesh Babulal
2012-02-01 13:55   ` Peter Zijlstra
2012-02-01 17:07     ` Rakib Mullick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).