From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753242AbbF2Ivv (ORCPT ); Mon, 29 Jun 2015 04:51:51 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:49484 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751612AbbF2Ivn (ORCPT ); Mon, 29 Jun 2015 04:51:43 -0400 Date: Mon, 29 Jun 2015 10:51:27 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: paulmck@linux.vnet.ibm.com, tj@kernel.org, mingo@redhat.com, der.herr@hofr.at, dave@stgolabs.net, riel@redhat.com, viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/6] stop_machine: kill stop_cpus_mutex and stop_cpus_lock Message-ID: <20150629085127.GF19282@twins.programming.kicks-ass.net> References: <20150626021455.GA5675@redhat.com> <20150626122330.GY19282@twins.programming.kicks-ass.net> <20150626204612.GA14573@redhat.com> <20150629040251.GA14558@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150629040251.GA14558@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 29, 2015 at 06:02:51AM +0200, Oleg Nesterov wrote: > > Btw. I can't understand the cpu_active() checks in stop_two_cpus(). > > Do we really need them? > > Ah, please ignore. > > Yes, we can't rely on stopper->enabled check in cpu_stop_queue_work(), > cpu_stop_signal_done() does not update multi_stop_data->num_threads / > ->thread_ack. So we need to ensure that cpu_online() == T for both CPUS > or multi_cpu_stop() can hang. > > But we can't use cpu_online() instead, take_cpu_down() can be already > queued. > > So this relies on the fact that CPU_DOWN_PREPARE (which removes CPU > from cpu_active_mask) is called before stop_machine(take_cpu_down) and > we do not care that cpu_active() is not stable; if we see cpu_active() > cpu_online() can't change unders us because take_cpu_down() was not > queued. Just so. > If we change stop_two_cpus() to use stop_work_alloc_one() it can use > cpu_online(), So the one user of this actually needs cpu_active(); we do not want to go move tasks to an inactive cpu. So if you change this to cpu_online() we need to audit the user is doing the stricter test.