Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3870825imm; Mon, 30 Jul 2018 05:06:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUmF9gyeCAomNhq4GfrGWAxicp4dSum4lE4fNSInJgrM0fjeZff8i7/d6doOGJr1R22bIZ X-Received: by 2002:a17:902:e005:: with SMTP id ca5-v6mr16234905plb.224.1532952398533; Mon, 30 Jul 2018 05:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532952398; cv=none; d=google.com; s=arc-20160816; b=J/spVlFKFQlmi5aGlwrWrTyCsH0HIwDa/l9VSD8fWRSj7ptogBWm1J282ufJzsJayz bju7KzLdCLScP+YmXAwP1ki8dqknS8HXoU/UO6ZZ20byvL2BzYcUGdgfD5KgrlX/Mopq Tphc+Gn0gbAVaDTlt9abBBiXkVHsYNJ6Ft4WC+NKHdYhi8+Qv+YIUcv9UBdhp1TQaTZ5 nIHvSIIqFPzE9IG7lAQchPSzFSt8hfWBla+WfdJ3URXvpZsjPoEHfjwpmN2JlvAQXyz0 HVrV/4oO6Bh2imCiUglXXdrRcKYP3fNMxVnvI4kQcwdgu+N6Ja2lXoxbi+gs+7gt7rZY urhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=I4pqAmgkCp83QE3fW7yuB1QXMfPRJmG9pcfouqgOaKQ=; b=KGVuG763V6vJMwYNzOvOEf8l3tot+EW6Z7Q2+NefONJD5vCXDSvgCFEQxHoTfqLPLm Czhc/Yo6BTLY4m3pHZ0ZtLnBqwcNg08iZ2DnlsFaWB3btqiGGB/A/a42CHt1BvoGFaPC 1UxtIFPTbMNxugHm7dwK/aEfh8YGaujhg5TaqO0HuOU8Bwv6Oh3ZkTiaBjbzz7jWGXhq cHearXAq3Baq4IVI78s1Eep7wikpM+iM0D/s7ZJCsoqPlU3u8dFS17jKgwmcU4g14HoW 4e6cNVzTWAxDo4etjiUT/O0za7sKFZbTIbkAdwfm0iEQMZKHdKwsJ+Y79XGLfYWLMmVy KQ/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l63-v6si9575437plb.106.2018.07.30.05.06.23; Mon, 30 Jul 2018 05:06:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728666AbeG3NkQ (ORCPT + 99 others); Mon, 30 Jul 2018 09:40:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:41372 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726594AbeG3NkP (ORCPT ); Mon, 30 Jul 2018 09:40:15 -0400 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 34F40ADD9; Mon, 30 Jul 2018 12:05:34 +0000 (UTC) Date: Mon, 30 Jul 2018 14:05:29 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Ingo Molnar , Pavel Tatashin , Andrew Morton , Dan Williams , Jan Kara , Matthew Wilcox , =?iso-8859-1?B?Suly9G1l?= Glisse , Souptick Joarder , "Kirill A. Shutemov" , Vlastimil Babka , Oscar Salvador , YASUAKI ISHIMATSU , Mathieu Malaterre , Mel Gorman , Joonsoo Kim Subject: Re: [PATCH v1] mm: inititalize struct pages when adding a section Message-ID: <20180730120529.GN24267@dhcp22.suse.cz> References: <20180727165454.27292-1-david@redhat.com> <20180730113029.GM24267@dhcp22.suse.cz> <6cc416e7-522c-a67e-2706-f37aadff084f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6cc416e7-522c-a67e-2706-f37aadff084f@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 30-07-18 13:53:06, David Hildenbrand wrote: > On 30.07.2018 13:30, Michal Hocko wrote: > > On Fri 27-07-18 18:54:54, David Hildenbrand wrote: > >> Right now, struct pages are inititalized when memory is onlined, not > >> when it is added (since commit d0dc12e86b31 ("mm/memory_hotplug: optimize > >> memory hotplug")). > >> > >> remove_memory() will call arch_remove_memory(). Here, we usually access > >> the struct page to get the zone of the pages. > >> > >> So effectively, we access stale struct pages in case we remove memory that > >> was never onlined. So let's simply inititalize them earlier, when the > >> memory is added. We only have to take care of updating the zone once we > >> know it. We can use a dummy zone for that purpose. > > > > I have considered something like this when I was reworking memory > > hotplug to not associate struct pages with zone before onlining and I > > considered this to be rather fragile. I would really not like to get > > back to that again if possible. > > > >> So effectively, all pages will already be initialized and set to > >> reserved after memory was added but before it was onlined (and even the > >> memblock is added). We only inititalize pages once, to not degrade > >> performance. > > > > To be honest, I would rather see d0dc12e86b31 reverted. It is late in > > the release cycle and if the patch is buggy then it should be reverted > > rather than worked around. I found the optimization not really > > convincing back then and this is still the case TBH. > > > > If I am not wrong, that's already broken in 4.17, no? What about that? Ohh, I thought this was merged in 4.18. $ git describe --contains d0dc12e86b31 --match="v*" v4.17-rc1~99^2~44 proves me wrong. This means that the fix is not so urgent as I thought. If you can figure out a reasonable fix then it should be preferable to the revert. Fake zone sounds too hackish to me though. -- Michal Hocko SUSE Labs