mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org,
	rusty@rustcorp.com.au, fweisbec@gmail.com, hch@infradead.org,
	mgorman@suse.de, riel@redhat.com, bp@suse.de,
	rostedt@goodmis.org, mgalbraith@suse.de, ego@linux.vnet.ibm.com,
	paulmck@linux.vnet.ibm.com, oleg@redhat.com, rjw@rjwysocki.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] CPU hotplug, stop-machine: Plug race-window that leads to "IPI-to-offline-CPU"
Date: Tue, 6 May 2014 16:42:48 -0400	[thread overview]
Message-ID: <20140506204248.GH27738@htj.dyndns.org> (raw)
In-Reply-To: <20140506134054.8cd531296c8aa5d9c3eff958@linux-foundation.org>

On Tue, May 06, 2014 at 01:40:54PM -0700, Andrew Morton wrote:
> On Tue, 06 May 2014 23:33:03 +0530 "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com> wrote:
> 
> > --- a/kernel/stop_machine.c
> > +++ b/kernel/stop_machine.c
> > @@ -165,12 +165,21 @@ static void ack_state(struct multi_stop_data *msdata)
> >  		set_state(msdata, msdata->state + 1);
> >  }
> >  
> > +/* Holding area for active CPUs, to let all the non-active CPUs go first */
> > +static void hold_active_cpus(struct multi_stop_data *msdata,
> > +			     int num_active_cpus)
> > +{
> > +	/* Wait until all the non-active threads ack the state */
> > +	while (atomic_read(&msdata->thread_ack) > num_active_cpus)
> > +		cpu_relax();
> > +}
> 
> The code comments are a bit lame.  Can we do a better job of explaining
> the overall dynamic behaviour?  Help readers to understand the problem
> which hold_active_cpus() is solving and how it solves it?

Does it even need to be a separate function?  I kinda really dislike
trivial helpers which are used only once.  It obfuscates more than
helping anything.  I think proper comment where the actual
synchronization is happening along with open coded wait would be
easier to follow.

Thanks.

-- 
tejun

  reply	other threads:[~2014-05-06 20:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 18:02 [PATCH 0/2] CPU hotplug: Fix the long-standing "IPI to offline CPU" issue Srivatsa S. Bhat
2014-05-06 18:02 ` [PATCH 1/2] smp: Print more useful debug info upon receiving IPI on an offline CPU Srivatsa S. Bhat
2014-05-06 20:34   ` Andrew Morton
2014-05-06 21:23     ` Srivatsa S. Bhat
2014-05-06 22:01       ` [PATCH v2 " Srivatsa S. Bhat
2014-05-06 18:03 ` [PATCH 2/2] CPU hotplug, stop-machine: Plug race-window that leads to "IPI-to-offline-CPU" Srivatsa S. Bhat
2014-05-06 20:40   ` Andrew Morton
2014-05-06 20:42     ` Tejun Heo [this message]
2014-05-06 21:27       ` Srivatsa S. Bhat
2014-05-06 22:01         ` [PATCH v2 " Srivatsa S. Bhat
2014-05-10  3:06           ` Tejun Heo
2014-05-11 20:07             ` Srivatsa S. Bhat

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=20140506204248.GH27738@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=ego@linux.vnet.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgalbraith@suse.de \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    /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®