From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754161AbaEFV2l (ORCPT ); Tue, 6 May 2014 17:28:41 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:49101 "EHLO e23smtp06.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbaEFV2j (ORCPT ); Tue, 6 May 2014 17:28:39 -0400 Message-ID: <536953C4.8030201@linux.vnet.ibm.com> Date: Wed, 07 May 2014 02:57:32 +0530 From: "Srivatsa S. Bhat" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 MIME-Version: 1.0 To: Tejun Heo CC: Andrew Morton , 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" References: <20140506180213.14375.5904.stgit@srivatsabhat.in.ibm.com> <20140506180258.14375.20181.stgit@srivatsabhat.in.ibm.com> <20140506134054.8cd531296c8aa5d9c3eff958@linux-foundation.org> <20140506204248.GH27738@htj.dyndns.org> In-Reply-To: <20140506204248.GH27738@htj.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14050621-7014-0000-0000-000004D757E9 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/07/2014 02:12 AM, Tejun Heo wrote: > 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" 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. > Ok, I'll open code it and add an appropriate comment explaining the synchronization. Thank you! Regards, Srivatsa S. Bhat