mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Zhong <zhong@linux.vnet.ibm.com>
To: Li Zefan <lizefan@huawei.com>
Cc: linux-kernel@vger.kernel.org, tj@kernel.org
Subject: Re: [PATCH cpuset] Use rebuild_sched_domains() in cpuset_hotplug_workfn()
Date: Mon, 08 Apr 2013 17:51:32 +0800	[thread overview]
Message-ID: <1365414692.2753.83.camel@ThinkPad-T5421.cn.ibm.com> (raw)
In-Reply-To: <515BF737.7070105@huawei.com>

On Wed, 2013-04-03 at 17:32 +0800, Li Zefan wrote:
> On 2013/4/2 15:16, Li Zhong wrote:
> > In cpuset_hotplug_workfn(), partition_sched_domains() is called without
> > hotplug lock held, which is actually needed (stated in the function
> > header of partition_sched_domains()). 
> > 
> > This patch tries to use rebuild_sched_domains() to solve the above
> > issue, and makes the code looks a little simpler.
> > 
Hi Zefan, 

Thanks for your quick review.

> I guess you found this just by code inspection, right?

Ah, yes :)

> The change looks fine and safe at a first glance, but we don't have
> time to review the patch for now.
> 
> However I don't know why partition_sched_domains() has to be called
> with hotplug lock held.
> 
> After a quick scan, seems the only place in partition_sched_domains()
> that might need hotplug lock is arch_update_cpu_topology().

and cpu_attach_domain(), which is called by partition_sched_domains()
also states that it needs hotplug lock be held.

It seems that the code is moved out of hotplug critical section after it
is converted to work functions. 

Thanks, Zhong

> 
> It would be better if you had CCed the scheduler guys...They may
> know the answer.
> 
> > Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
> > ---
> >  kernel/cpuset.c |   13 ++-----------
> >  1 files changed, 2 insertions(+), 11 deletions(-)
> > 
> > diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> > index 4f9dfe4..515a713 100644
> > --- a/kernel/cpuset.c
> > +++ b/kernel/cpuset.c
> > @@ -2222,17 +2222,8 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
> >  	flush_workqueue(cpuset_propagate_hotplug_wq);
> >  
> >  	/* rebuild sched domains if cpus_allowed has changed */
> > -	if (cpus_updated) {
> > -		struct sched_domain_attr *attr;
> > -		cpumask_var_t *doms;
> > -		int ndoms;
> > -
> > -		mutex_lock(&cpuset_mutex);
> > -		ndoms = generate_sched_domains(&doms, &attr);
> > -		mutex_unlock(&cpuset_mutex);
> > -
> > -		partition_sched_domains(ndoms, doms, attr);
> > -	}
> > +	if (cpus_updated)
> > +		rebuild_sched_domains();
> >  }
> >  
> 
> 



  reply	other threads:[~2013-04-08 10:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02  7:16 Li Zhong
2013-04-03  9:32 ` Li Zefan
2013-04-08  9:51   ` Li Zhong [this message]
2013-04-09  9:59     ` [RFC PATCH v2 cpuset] Don't pass offlined cpus to partition_sched_domains() Li Zhong
2013-04-11  8:57       ` Li Zefan
2013-04-12 10:11         ` Li Zhong

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=1365414692.2753.83.camel@ThinkPad-T5421.cn.ibm.com \
    --to=zhong@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=tj@kernel.org \
    /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®