From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752269AbbFZCdR (ORCPT ); Thu, 25 Jun 2015 22:33:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35610 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751195AbbFZCdI (ORCPT ); Thu, 25 Jun 2015 22:33:08 -0400 Date: Fri, 26 Jun 2015 04:31:49 +0200 From: Oleg Nesterov To: Peter Zijlstra , 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 Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/6] stop_machine: kill stop_cpus_mutex and stop_cpus_lock Message-ID: <20150626023149.GA6178@redhat.com> References: <20150626021455.GA5675@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150626021455.GA5675@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As always, forgot to mention... Also. We can turn these stop_work_alloc/stop_work_free into the generic helpers which (I think) can have more users. On 06/26, Oleg Nesterov wrote: > > On 06/25, Peter Zijlstra wrote: > > > > On Tue, Jun 23, 2015 at 07:24:16PM +0200, Oleg Nesterov wrote: > > > > > > lock_stop_cpus_works(cpumask) > > > { > > > for_each_cpu(cpu, cpumask) > > > mutex_lock(per_cpu(cpu_stopper_task, cpu).work_mutex); > > > } > > > > > > unlock_stop_cpus_works(cpumask) > > > { > > > for_each_cpu(cpu, cpumask) > > > mutex_lock(...); > > > } > > > > > > which should be used instead of stop_cpus_mutex. After this change > > > stop_two_cpus() can just use stop_cpus(). > > > > Right, lockdep annotating that will be 'interesting' though. > > Sure, and this is too inefficient, this is only to explain what > I mean. > > How about this series? Untested. For review. > > > And > > stop_two_cpus() then has the problem of allocating a cpumask. > > Yes, but we can avoid this, see the changelog in 5/6. > > > Simpler to > > let it keep 'abuse' the queueing spinlock in there. > > Not sure. > > And note that this series kills stop_cpus_mutex, so that multiple > stop_cpus()'s / stop_machine()'s can run in parallel if cpumask's > do not overlap. > > Note also the changelog in 6/6, we can simplify + optimize this code > a bit more. > > What do you think? > > Oleg. > > include/linux/lglock.h | 5 - > kernel/locking/lglock.c | 22 ----- > kernel/stop_machine.c | 197 ++++++++++++++++++++++++++++------------------- > 3 files changed, 119 insertions(+), 105 deletions(-)