From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C24C00449 for ; Wed, 3 Oct 2018 13:59:00 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 882FF2089F for ; Wed, 3 Oct 2018 13:58:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 882FF2089F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42QHgP32kCzF36V for ; Wed, 3 Oct 2018 23:58:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; spf=softfail (mailfrom) smtp.mailfrom=kernel.org (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=mhocko@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42QHYx5Y2mzF388 for ; Wed, 3 Oct 2018 23:54:13 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1113CAF55; Wed, 3 Oct 2018 13:54:10 +0000 (UTC) Date: Wed, 3 Oct 2018 15:54:07 +0200 From: Michal Hocko To: David Hildenbrand Subject: Re: [PATCH RFC] mm/memory_hotplug: Introduce memory block types Message-ID: <20181003135407.GI4714@dhcp22.suse.cz> References: <20180928150357.12942-1-david@redhat.com> <20181001084038.GD18290@dhcp22.suse.cz> <20181002134734.GT18290@dhcp22.suse.cz> <98fb8d65-b641-2225-f842-8804c6f79a06@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <98fb8d65-b641-2225-f842-8804c6f79a06@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Rich Felker , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Dave Hansen , Heiko Carstens , linux-mm@kvack.org, Pavel Tatashin , Paul Mackerras , "H. Peter Anvin" , Rashmica Gupta , "K. Y. Srinivasan" , Boris Ostrovsky , linux-s390@vger.kernel.org, Michael Neuling , Stephen Hemminger , Yoshinori Sato , linux-acpi@vger.kernel.org, Ingo Molnar , xen-devel@lists.xenproject.org, Rob Herring , Len Brown , Fenghua Yu , Stephen Rothwell , "mike.travis@hpe.com" , Haiyang Zhang , Dan Williams , Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Nicholas Piggin , Joe Perches , =?iso-8859-1?B?Suly9G1l?= Glisse , Mike Rapoport , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Joonsoo Kim , Oscar Salvador , Juergen Gross , Tony Luck , Mathieu Malaterre , Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Mauricio Faria de Oliveira , Philippe Ombredanne , Martin Schwidefsky , devel@linuxdriverproject.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, "Kirill A. Shutemov" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue 02-10-18 17:25:19, David Hildenbrand wrote: > On 02/10/2018 15:47, Michal Hocko wrote: [...] > > Zone imbalance is an inherent problem of the highmem zone. It is > > essentially the highmem zone we all loved so much back in 32b days. > > Yes the movable zone doesn't have any addressing limitations so it is a > > bit more relaxed but considering the hotplug scenarios I have seen so > > far people just want to have full NUMA nodes movable to allow replacing > > DIMMs. And then we are back to square one and the zone imbalance issue. > > You have those regardless where memmaps are allocated from. > > Unfortunately yes. And things get more complicated as you are adding a > whole DIMMs and get notifications in the granularity of memory blocks. > Usually you are not interested in onlining any memory block of that DIMM > as MOVABLE as soon as you would have to online one memory block of that > DIMM as NORMAL - because that can already block the whole DIMM. For the purpose of the hotremove, yes. But as Dave has noted people are (ab)using zone movable for other purposes - e.g. large pages. [...] > > Then the immediate question would be why to use memory hotplug for that > > at all? Why don't you simply start with a huge pre-allocated physical > > address space and balloon memory in an out per demand. Why do you want > > to inject new memory during the runtime? > > Let's assume you have a guest with 20GB size and eventually want to > allow to grow it to 4TB. You would have to allocate metadata for 4TB > right from the beginning. That's definitely now what we want. That is > why memory hotplug is used by e.g. XEN or Hyper-V. With Hyper-V, the > hypervisor even tells you at which places additional memory has been > made available. Then you have to live with the fact that your hot added memory will be self hosted and find a way for ballooning to work with that. The price would be that some part of the memory is not really balloonable in the end. > >> 1. is a reason why distributions usually don't configure > >> "MEMORY_HOTPLUG_DEFAULT_ONLINE", because you really want the option for > >> MOVABLE zone. That however implies, that e.g. for x86, you have to > >> handle all new memory in user space, especially also HyperV memory. > >> There, you then have to check for things like "isHyperV()" to decide > >> "oh, yes, this should definitely not go to the MOVABLE zone". > > > > Why do you need a generic hotplug rule in the first place? Why don't you > > simply provide different set of rules for different usecases? Let users > > decide which usecase they prefer rather than try to be clever which > > almost always hits weird corner cases. > > > > Memory hotplug has to work as reliable as we can out of the box. Letting > the user make simple decisions like "oh, I am on hyper-V, I want to > online memory to the normal zone" does not feel right. Users usually know what is their usecase and then it is just a matter of plumbing (e.g. distribution can provide proper tools to deploy those usecases) to chose the right and for user obscure way to make it work. > But yes, we > should definitely allow to make modifications. So some sane default rule > + possible modification is usually a good idea. > > I think Dave has a point with using MOVABLE for huge page use cases. And > there might be other corner cases as you correctly state. > > I wonder if this patch itself minus modifying online/offline might make > sense. We can then implement simple rules in user space > > if (normal) { > /* customers expect hotplugged DIMMs to be unpluggable */ > online_movable(); > } else if (paravirt) { > /* paravirt memory should as default always go to the NORMAL */ > online(); > } else { > /* standby memory will never get onlined automatically */ > } > > Compared to having to guess what is to be done (isKVM(), isHyperV, > isS390 ...) and failing once this is no longer unique (e.g. virtio-mem > and ACPI support for x86 KVM). I am worried that exporing a type will just push us even further to the corner. The current design is really simple and 2 stage and that is good because it allows for very different usecases. The more specific the API be the more likely we are going to hit "I haven't even dreamed somebody would be using hotplug for this thing". And I would bet this will happen sooner or later. Just look at how the whole auto onlining screwed the API to workaround an implementation detail. It has created a one purpose behavior that doesn't suite many usecases. Yet we have to live with that because somebody really relies on it. Let's not repeat same errors. -- Michal Hocko SUSE Labs