lkml.org 
[lkml]   [2008]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched: missing locking in sched_domains code
On Mon, Apr 28, 2008 at 12:28:53AM -0700, Andrew Morton wrote:
> On Mon, 28 Apr 2008 09:09:46 +0200 Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
>
> > On Sun, Apr 27, 2008 at 06:39:26PM -0700, Andrew Morton wrote:
> > > On Sun, 27 Apr 2008 23:12:24 +0200 Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> > > > Index: linux-2.6/kernel/cpuset.c
> > > > ===================================================================
> > > > --- linux-2.6.orig/kernel/cpuset.c
> > > > +++ linux-2.6/kernel/cpuset.c
> > > > @@ -684,7 +684,9 @@ restart:
> > > > rebuild:
> > > > /* Have scheduler rebuild sched domains */
> > > > get_online_cpus();
> > > > + mutex_lock(&sched_domains_mutex);
> > > > partition_sched_domains(ndoms, doms, dattr);
> > > > + mutex_unlock(&sched_domains_mutex);
> > > > put_online_cpus();
> > > >
> > >
> > > It seems a bit fragile to take this lock in the caller without even adding
> > > a comment at the callee site which documents the new locking rule.
> > >
> > > It would be more robust to take the lock within partition_sched_domains().
> > >
> > > partition_sched_domains() already covers itself with lock_doms_cur(). Can
> > > we take that in arch_reinit_sched_domains() rather than adding the new lock?
> >
> > I think you meant taking it in partition_sched_domains?
>
> What I meant was: rather than adding the new sched_domains_mutex, can we
> instead call lock_doms_cur() from arch_reinit_sched_domains() and
> sched_init_smp()? Borrow the existing lock?
>
> Whether that makes sense depends upon what lock_doms_cur() semantically
> *means*. As that appears to be somewhat of a secret, we get to decide ;)

Oh, I didn't realize that lock_doms_cur() was only used in one function.
So that should work. Will try.


\
 
 \ /
  Last update: 2008-04-28 09:55    [W:0.049 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site