Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780AbdGCT5m (ORCPT ); Mon, 3 Jul 2017 15:57:42 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:45165 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754608AbdGCT5i (ORCPT ); Mon, 3 Jul 2017 15:57:38 -0400 Date: Mon, 3 Jul 2017 21:57:18 +0200 (CEST) From: Thomas Gleixner To: Michal Hocko cc: Andrey Ryabinin , LKML , "linux-mm@kvack.org" , Andrew Morton , Vlastimil Babka , Vladimir Davydov , Heiko Carstens Subject: Re: [PATCH] mm/memory-hotplug: Switch locking to a percpu rwsem In-Reply-To: <20170703163204.GE11848@dhcp22.suse.cz> Message-ID: References: <20170630092747.GD22917@dhcp22.suse.cz> <20170703163204.GE11848@dhcp22.suse.cz> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1371 Lines: 43 On Mon, 3 Jul 2017, Michal Hocko wrote: > On Fri 30-06-17 12:15:21, Thomas Gleixner wrote: > [...] > > Sure. Just to make you to mull over more stuff, find below the patch which > > moves all of this to use the cpuhotplug lock. > > > > Thanks, > > > > tglx > > > > 8<-------------------- > > Subject: mm/memory-hotplug: Use cpu hotplug lock > > From: Thomas Gleixner > > Date: Thu, 29 Jun 2017 16:30:00 +0200 > > > > Most place which take the memory hotplug lock take the cpu hotplug lock as > > well. Avoid the double locking and use the cpu hotplug lock for both. > > Hmm, I am usually not a fan of locks conflating because it is then less > clear what the lock actually protects. Memory and cpu hotplugs should > be largely independent so I am not sure this patch simplify things a > lot. It is nice to see few lines go away but I am little bit worried > that we will enventually develop a separate locking again in future for > some weird memory hotplug usecases. Fair enough. > > > Not-Yet-Signed-off-by: Thomas Gleixner > [...] > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > [...] > > @@ -2138,7 +2114,7 @@ void __ref remove_memory(int nid, u64 st > > > > try_offline_node(nid); > > > > - mem_hotplug_done(); > > + cpus_write_lock(); > > unlock you meant here, right? Doh, -ENOQUILTREFRESH