All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
@ 2006-06-25  0:50 Oleg Nesterov
  2006-06-25 15:35 ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Oleg Nesterov @ 2006-06-25  0:50 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, Andrew Morton, linux-kernel

Thomas Gleixner wrote:
>
> There is no need to hold tasklist_lock across the setscheduler call, when we
> pin the task structure with get_task_struct(). Interrupts are disabled in 
> setscheduler anyway and the permission checks do not need interrupts disabled.
>
> --- linux-2.6.17-mm.orig/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> +++ linux-2.6.17-mm/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> @@ -4140,8 +4140,10 @@
>  		read_unlock_irq(&tasklist_lock);
>  		return -ESRCH;
>  	}
> -	retval = sched_setscheduler(p, policy, &lparam);
> +	get_task_struct(p);
>  	read_unlock_irq(&tasklist_lock);
> +	retval = sched_setscheduler(p, policy, &lparam);
> +	put_task_struct(p);
>  	return retval;
>  }

But we don't need read_lock(tasklist) and get_task_struct(p) at all?

rcu_read_lock/rcu_read_unlock is enough, no?

Oleg.


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

* Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
  2006-06-25  0:50 [patch 1/3] Drop tasklist lock in do_sched_setscheduler Oleg Nesterov
@ 2006-06-25 15:35 ` Thomas Gleixner
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-25 15:35 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Ingo Molnar, Andrew Morton, linux-kernel

On Sun, 2006-06-25 at 04:50 +0400, Oleg Nesterov wrote:
> Thomas Gleixner wrote:
> >
> > There is no need to hold tasklist_lock across the setscheduler call, when we
> > pin the task structure with get_task_struct(). Interrupts are disabled in 
> > setscheduler anyway and the permission checks do not need interrupts disabled.
> >
> > --- linux-2.6.17-mm.orig/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> > +++ linux-2.6.17-mm/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> > @@ -4140,8 +4140,10 @@
> >  		read_unlock_irq(&tasklist_lock);
> >  		return -ESRCH;
> >  	}
> > -	retval = sched_setscheduler(p, policy, &lparam);
> > +	get_task_struct(p);
> >  	read_unlock_irq(&tasklist_lock);
> > +	retval = sched_setscheduler(p, policy, &lparam);
> > +	put_task_struct(p);
> >  	return retval;
> >  }
> 
> But we don't need read_lock(tasklist) and get_task_struct(p) at all?
> 
> rcu_read_lock/rcu_read_unlock is enough, no?

Probably yes, did not think about that

	tglx



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

* Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
  2006-06-24  8:07   ` Andrew Morton
@ 2006-06-24  8:25     ` Thomas Gleixner
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-24  8:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, mingo

On Sat, 2006-06-24 at 01:07 -0700, Andrew Morton wrote:

> These three patches had intricate dependencies upon the __IP__ and
> __IP_DECL__ gunk which later patches removed, so these patches do not
> compile against the pi-futex patches.
> 
> So I dropped these.
> 
> And I'll drop the lockdep patches, so you'll be able to redo these.

Will do.

	tglx



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

* Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
  2006-06-22  9:08 ` [patch 1/3] Drop tasklist lock in do_sched_setscheduler Thomas Gleixner
  2006-06-23  1:48   ` Andrew Morton
@ 2006-06-24  8:07   ` Andrew Morton
  2006-06-24  8:25     ` Thomas Gleixner
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2006-06-24  8:07 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, mingo

On Thu, 22 Jun 2006 09:08:38 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:

> 
> There is no need to hold tasklist_lock across the setscheduler call, when we
> pin the task structure with get_task_struct(). Interrupts are disabled in 
> setscheduler anyway and the permission checks do not need interrupts disabled.
> 

These three patches had intricate dependencies upon the __IP__ and
__IP_DECL__ gunk which later patches removed, so these patches do not
compile against the pi-futex patches.

So I dropped these.

And I'll drop the lockdep patches, so you'll be able to redo these.

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

* Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
  2006-06-23  1:48   ` Andrew Morton
@ 2006-06-23  6:01     ` Thomas Gleixner
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-23  6:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, mingo

On Thu, 2006-06-22 at 18:48 -0700, Andrew Morton wrote:
> On Thu, 22 Jun 2006 09:08:38 -0000
> Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> > 
> > There is no need to hold tasklist_lock across the setscheduler call, when we
> > pin the task structure with get_task_struct(). Interrupts are disabled in 
> > setscheduler anyway and the permission checks do not need interrupts disabled.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> >  kernel/sched.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > Index: linux-2.6.17-mm/kernel/sched.c
> > ===================================================================
> > --- linux-2.6.17-mm.orig/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> > +++ linux-2.6.17-mm/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> > @@ -4140,8 +4140,10 @@
> >  		read_unlock_irq(&tasklist_lock);
> >  		return -ESRCH;
> >  	}
> > -	retval = sched_setscheduler(p, policy, &lparam);
> > +	get_task_struct(p);
> >  	read_unlock_irq(&tasklist_lock);
> > +	retval = sched_setscheduler(p, policy, &lparam);
> > +	put_task_struct(p);
> >  	return retval;
> >  }
> >  
> 
> Is this optimisation actually related to the rt-mutex patches, or to the
> other two patches?

Yes. We neither want interrupt disabled nor holding tasklist lock when
it comes to the lock chain walk. So its a preperatory patch and a
general optimization.

	tglx



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

* Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
  2006-06-22  9:08 ` [patch 1/3] Drop tasklist lock in do_sched_setscheduler Thomas Gleixner
@ 2006-06-23  1:48   ` Andrew Morton
  2006-06-23  6:01     ` Thomas Gleixner
  2006-06-24  8:07   ` Andrew Morton
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2006-06-23  1:48 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, mingo

On Thu, 22 Jun 2006 09:08:38 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:

> 
> There is no need to hold tasklist_lock across the setscheduler call, when we
> pin the task structure with get_task_struct(). Interrupts are disabled in 
> setscheduler anyway and the permission checks do not need interrupts disabled.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
>  kernel/sched.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.17-mm/kernel/sched.c
> ===================================================================
> --- linux-2.6.17-mm.orig/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> +++ linux-2.6.17-mm/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> @@ -4140,8 +4140,10 @@
>  		read_unlock_irq(&tasklist_lock);
>  		return -ESRCH;
>  	}
> -	retval = sched_setscheduler(p, policy, &lparam);
> +	get_task_struct(p);
>  	read_unlock_irq(&tasklist_lock);
> +	retval = sched_setscheduler(p, policy, &lparam);
> +	put_task_struct(p);
>  	return retval;
>  }
>  

Is this optimisation actually related to the rt-mutex patches, or to the
other two patches?


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

* [patch 1/3] Drop tasklist lock in do_sched_setscheduler
  2006-06-22  9:08 [patch 0/3] rtmutex: Propagate priority setting into lock chains Thomas Gleixner
@ 2006-06-22  9:08 ` Thomas Gleixner
  2006-06-23  1:48   ` Andrew Morton
  2006-06-24  8:07   ` Andrew Morton
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-22  9:08 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Ingo Molnar

[-- Attachment #1: drop-tasklist-lock-in-do-sched-setscheduler.patch --]
[-- Type: text/plain, Size: 948 bytes --]


There is no need to hold tasklist_lock across the setscheduler call, when we
pin the task structure with get_task_struct(). Interrupts are disabled in 
setscheduler anyway and the permission checks do not need interrupts disabled.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

 kernel/sched.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.17-mm/kernel/sched.c
===================================================================
--- linux-2.6.17-mm.orig/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
+++ linux-2.6.17-mm/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
@@ -4140,8 +4140,10 @@
 		read_unlock_irq(&tasklist_lock);
 		return -ESRCH;
 	}
-	retval = sched_setscheduler(p, policy, &lparam);
+	get_task_struct(p);
 	read_unlock_irq(&tasklist_lock);
+	retval = sched_setscheduler(p, policy, &lparam);
+	put_task_struct(p);
 	return retval;
 }
 

--


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

end of thread, other threads:[~2006-06-25 15:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-25  0:50 [patch 1/3] Drop tasklist lock in do_sched_setscheduler Oleg Nesterov
2006-06-25 15:35 ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2006-06-22  9:08 [patch 0/3] rtmutex: Propagate priority setting into lock chains Thomas Gleixner
2006-06-22  9:08 ` [patch 1/3] Drop tasklist lock in do_sched_setscheduler Thomas Gleixner
2006-06-23  1:48   ` Andrew Morton
2006-06-23  6:01     ` Thomas Gleixner
2006-06-24  8:07   ` Andrew Morton
2006-06-24  8:25     ` Thomas Gleixner

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.