From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753296AbdBITRo (ORCPT ); Thu, 9 Feb 2017 14:17:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:42485 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbdBITRm (ORCPT ); Thu, 9 Feb 2017 14:17:42 -0500 Date: Thu, 9 Feb 2017 20:15:47 +0100 From: Michal Hocko To: Christoph Lameter Cc: Thomas Gleixner , Mel Gorman , Vlastimil Babka , Dmitry Vyukov , Tejun Heo , "linux-mm@kvack.org" , LKML , Ingo Molnar , Peter Zijlstra , syzkaller , Andrew Morton Subject: Re: mm: deadlock between get_online_cpus/pcpu_alloc Message-ID: <20170209191547.GA31906@dhcp22.suse.cz> References: <20170208152106.GP5686@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 09-02-17 11:22:49, Cristopher Lameter wrote: > On Thu, 9 Feb 2017, Thomas Gleixner wrote: > > > You are just not getting it, really. > > > > The problem is that this for_each_online_cpu() is racy against a concurrent > > hot unplug and therefor can queue stuff for a not longer online cpu. That's > > what the mm folks tried to avoid by preventing a CPU hotplug operation > > before entering that loop. > > With a stop machine action it is NOT racy because the machine goes into a > special kernel state that guarantees that key operating system structures > are not touched. See mm/page_alloc.c's use of that characteristic to build > zonelists. Thus it cannot be executing for_each_online_cpu and related > tasks (unless one does not disable preempt .... but that is a given if a > spinlock has been taken).. Christoph, you are completely ignoring the reality and the code. There is no need for stop_machine nor it is helping anything. As the matter of fact there is a synchronization with the cpu hotplug needed if you want to make a per-cpu specific operations. get_online_cpus is the most straightforward and heavy weight way to do this synchronization but not the only one. As the patch [1] describes we do not really need get_online_cpus in drain_all_pages because we can do _better_. But this is not in any way a generic thing applicable to other code paths. If you disagree then you are free to post patches but hand waving you are doing here is just wasting everybody's time. So please cut it here unless you have specific proposals to improve the current situation. Thanks! [1] http://lkml.kernel.org/r/20170207201950.20482-1-mhocko@kernel.org -- Michal Hocko SUSE Labs