mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Gautham R Shenoy <ego@in.ibm.com>, Ingo Molnar <mingo@elte.hu>,
	Paul Jackson <pj@sgi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: missing locking in sched_domains code
Date: Mon, 28 Apr 2008 09:52:53 +0200	[thread overview]
Message-ID: <20080428075253.GB4507@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20080428002853.1693e7fd.akpm@linux-foundation.org>

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.

  reply	other threads:[~2008-04-28  7:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-27 21:12 Heiko Carstens
2008-04-28  1:39 ` Andrew Morton
2008-04-28  7:09   ` Heiko Carstens
2008-04-28  7:24     ` Ingo Molnar
2008-04-28  7:28     ` Andrew Morton
2008-04-28  7:52       ` Heiko Carstens [this message]
2008-04-28  8:11         ` Heiko Carstens
2008-04-28  8:32           ` Ingo Molnar
2008-04-28  8:49             ` Heiko Carstens
2008-04-28  8:57               ` Andrew Morton
2008-04-28  9:17                 ` Heiko Carstens
2008-04-28  9:31                   ` Andrew Morton
2008-04-28  9:33                   ` Heiko Carstens
2008-04-28 12:27                     ` Ingo Molnar
2008-04-28 13:13                     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080428075253.GB4507@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pj@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®