lkml.org 
[lkml]   [2006]   [Jun]   [23]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
FromThomas Gleixner <>
DateFri, 23 Jun 2006 08:01:39 +0200
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


-
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/

\
 
 \ /
  Last update: 2006-06-23 08:02    [from the cache]
©2003-2008