From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id A82446B0008 for ; Wed, 3 Oct 2018 10:34:23 -0400 (EDT) Received: by mail-qk1-f199.google.com with SMTP id v14-v6so5136376qkg.8 for ; Wed, 03 Oct 2018 07:34:23 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id i11-v6si1001029qvb.29.2018.10.03.07.34.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:34:22 -0700 (PDT) From: Vitaly Kuznetsov Subject: Re: [PATCH RFC] mm/memory_hotplug: Introduce memory block types In-Reply-To: <49456818-238e-2d95-9df6-d1934e9c8b53@linux.intel.com> References: <20180928150357.12942-1-david@redhat.com> <20181001084038.GD18290@dhcp22.suse.cz> <20181002134734.GT18290@dhcp22.suse.cz> <98fb8d65-b641-2225-f842-8804c6f79a06@redhat.com> <8736tndubn.fsf@vitty.brq.redhat.com> <20181003134444.GH4714@dhcp22.suse.cz> <87zhvvcf3b.fsf@vitty.brq.redhat.com> <49456818-238e-2d95-9df6-d1934e9c8b53@linux.intel.com> Date: Wed, 03 Oct 2018 16:34:03 +0200 Message-ID: <87tvm3cd5w.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: To: Dave Hansen , Michal Hocko Cc: David Hildenbrand , Kate Stewart , Rich Felker , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Benjamin Herrenschmidt , Balbir Singh , Heiko Carstens , linux-mm@kvack.org, Pavel Tatashin , Paul Mackerras , "H. Peter Anvin" , Rashmica Gupta , Boris Ostrovsky , linux-s390@vger.kernel.org, Michael Neuling , Stephen Hemminger , Yoshinori Sato , Michael Ellerman , 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 =?utf-8?Q?Neusch=C3=A4fer?= , Nicholas Piggin , Joe Perches , =?utf-8?B?SsOpcsO0?= =?utf-8?B?bWU=?= 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" Dave Hansen writes: > On 10/03/2018 06:52 AM, Vitaly Kuznetsov wrote: >> It is more than just memmaps (e.g. forking udev process doing memory >> onlining also needs memory) but yes, the main idea is to make the >> onlining synchronous with hotplug. > > That's a good theoretical concern. > > But, is it a problem we need to solve in practice? Yes, unfortunately. It was previously discovered that when we try to hotplug tons of memory to a low memory system (this is a common scenario with VMs) we end up with OOM because for all new memory blocks we need to allocate page tables, struct pages, ... and we need memory to do that. The userspace program doing memory onlining also needs memory to run and in case it prefers to fork to handle hundreds of notfifications ... well, it may get OOMkilled before it manages to online anything. Allocating all kernel objects from the newly hotplugged blocks would definitely help to manage the situation but as I said this won't solve the 'forking udev' problem completely (it will likely remain in 'extreme' cases only. We can probably work around it by onlining with a dedicated process which doesn't do memory allocation). -- Vitaly