[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080428075253.GB4507@osiris.boeblingen.de.ibm.com>
Date: Mon, 28 Apr 2008 09:52:53 +0200
From: Heiko Carstens <heiko.carstens@...ibm.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Gautham R Shenoy <ego@...ibm.com>, Ingo Molnar <mingo@...e.hu>,
Paul Jackson <pj@....com>, linux-kernel@...r.kernel.org
Subject: Re: [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@...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@...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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists