From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754289AbdBIR0V (ORCPT ); Thu, 9 Feb 2017 12:26:21 -0500 Received: from resqmta-ch2-10v.sys.comcast.net ([69.252.207.42]:50815 "EHLO resqmta-ch2-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752702AbdBIR0S (ORCPT ); Thu, 9 Feb 2017 12:26:18 -0500 Date: Thu, 9 Feb 2017 11:22:49 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Thomas Gleixner cc: Michal Hocko , 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 In-Reply-To: Message-ID: References: <20170207123708.GO5065@dhcp22.suse.cz> <20170207135846.usfrn7e4znjhmogn@techsingularity.net> <20170207141911.GR5065@dhcp22.suse.cz> <20170207153459.GV5065@dhcp22.suse.cz> <20170207162224.elnrlgibjegswsgn@techsingularity.net> <20170207164130.GY5065@dhcp22.suse.cz> <20170208073527.GA5686@dhcp22.suse.cz> <20170208152106.GP5686@dhcp22.suse.cz> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfKE3oK0uG6bUXU9kzMFsB+KU5aIlShFQM2tgF8pig50E1iKMeIKgkYBGkAJZnPMzRK+/t2JyT/e5rxIED4/kwkW/Knd2oB5J5xrbOsXcxy81CrTM3Z42 q/49Iz6HSpjAUXGUoLB80ErqZWtt9PwN3x9CLW8zQwSli9jgMvZZL1evk6SanPV9LJih7m3f3q0M1mt0HeAtKWFY1gz9OJRgxnvlXxRi/FxlSg5K36JTRp/w AWWx0ofsvxNM2Cl1yQY/dN9300Y0AdcxXtNSNlEUdeDKk3e+wdaMXsepXqQAGDlgewmF3jmKQtH01W2rx5GQSIVQbKOtGcYsqbgpFudELoR74bF6Bk6Xt06c TCkDZhx1GHQk/mAXbfNuzos3QAe9I5MZM2s1PSrv5yCjiOVQkeVxenvO1a5izeytXqjY8+Dbj5mZ/yGoYU61eiO+FNuspPdPeSIPmOzYg20oma5S+65aQ45E 0pl4/9GDMKysgzCvRJHTPMv6s6CxgEaD/mpPNA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).. > > Lets get rid of get_online_cpus() etc. > > And that solves what? It gets rid of future issues with serialization in paths were we need to lock and still do for_each_online_cpu(). > Can you please start to understand the scope of the whole hotplug machinery > including the requirements for get_online_cpus() before you waste > everybodys time with your uninformed and halfbaken proposals? Its an obvious solution to the issues that have arisen multiple times with get_online_cpus() within the slab allocators. The hotplug machinery should make things as easy as possible for other people and having these get_online_cpus() everywhere does complicate things. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f70.google.com (mail-it0-f70.google.com [209.85.214.70]) by kanga.kvack.org (Postfix) with ESMTP id 139246B0387 for ; Thu, 9 Feb 2017 12:22:54 -0500 (EST) Received: by mail-it0-f70.google.com with SMTP id 203so31700332ith.3 for ; Thu, 09 Feb 2017 09:22:54 -0800 (PST) Received: from resqmta-ch2-03v.sys.comcast.net (resqmta-ch2-03v.sys.comcast.net. [2001:558:fe21:29:69:252:207:35]) by mx.google.com with ESMTPS id b66si18381987iof.234.2017.02.09.09.22.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 09:22:53 -0800 (PST) Date: Thu, 9 Feb 2017 11:22:49 -0600 (CST) From: Christoph Lameter Subject: Re: mm: deadlock between get_online_cpus/pcpu_alloc In-Reply-To: Message-ID: References: <20170207123708.GO5065@dhcp22.suse.cz> <20170207135846.usfrn7e4znjhmogn@techsingularity.net> <20170207141911.GR5065@dhcp22.suse.cz> <20170207153459.GV5065@dhcp22.suse.cz> <20170207162224.elnrlgibjegswsgn@techsingularity.net> <20170207164130.GY5065@dhcp22.suse.cz> <20170208073527.GA5686@dhcp22.suse.cz> <20170208152106.GP5686@dhcp22.suse.cz> Content-Type: text/plain; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Thomas Gleixner Cc: Michal Hocko , Mel Gorman , Vlastimil Babka , Dmitry Vyukov , Tejun Heo , "linux-mm@kvack.org" , LKML , Ingo Molnar , Peter Zijlstra , syzkaller , Andrew Morton 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).. > > Lets get rid of get_online_cpus() etc. > > And that solves what? It gets rid of future issues with serialization in paths were we need to lock and still do for_each_online_cpu(). > Can you please start to understand the scope of the whole hotplug machinery > including the requirements for get_online_cpus() before you waste > everybodys time with your uninformed and halfbaken proposals? Its an obvious solution to the issues that have arisen multiple times with get_online_cpus() within the slab allocators. The hotplug machinery should make things as easy as possible for other people and having these get_online_cpus() everywhere does complicate things. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org