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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 7CEE7CA9EAF for ; Mon, 21 Oct 2019 14:43:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 48EBE2053B for ; Mon, 21 Oct 2019 14:43:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48EBE2053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E531C6B0006; Mon, 21 Oct 2019 10:43:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E02EF6B0008; Mon, 21 Oct 2019 10:43:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D183A6B000A; Mon, 21 Oct 2019 10:43:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id A9FC76B0006 for ; Mon, 21 Oct 2019 10:43:48 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 457148249980 for ; Mon, 21 Oct 2019 14:43:48 +0000 (UTC) X-FDA: 76068060936.23.crush06_40a98c6ad73f X-HE-Tag: crush06_40a98c6ad73f X-Filterd-Recvd-Size: 4676 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Oct 2019 14:43:47 +0000 (UTC) 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 6D9E6B794; Mon, 21 Oct 2019 14:43:46 +0000 (UTC) Date: Mon, 21 Oct 2019 16:43:45 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Oscar Salvador , Mel Gorman , Mike Rapoport , Dan Williams , Wei Yang , Alexander Duyck , Anshuman Khandual , Pavel Tatashin Subject: Re: [PATCH v1 1/2] mm/page_alloc.c: Don't set pages PageReserved() when offlining Message-ID: <20191021144345.GT9379@dhcp22.suse.cz> References: <20191021141927.10252-1-david@redhat.com> <20191021141927.10252-2-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191021141927.10252-2-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 21-10-19 16:19:25, David Hildenbrand wrote: > We call __offline_isolated_pages() from __offline_pages() after all > pages were isolated and are either free (PageBuddy()) or PageHWPoison. > Nothing can stop us from offlining memory at this point. > > In __offline_isolated_pages() we first set all affected memory sections > offline (offline_mem_sections(pfn, end_pfn)), to mark the memmap as > invalid (pfn_to_online_page() will no longer succeed), and then walk over > all pages to pull the free pages from the free lists (to the isolated > free lists, to be precise). > > Note that re-onlining a memory block will result in the whole memmap > getting reinitialized, overwriting any old state. We already poision the > memmap when offlining is complete to find any access to > stale/uninitialized memmaps. > > So, setting the pages PageReserved() is not helpful. The memap is marked > offline and all pageblocks are isolated. As soon as offline, the memmap > is stale either way. > > This looks like a leftover from ancient times where we initialized the > memmap when adding memory and not when onlining it (the pages were set > PageReserved so re-onling would work as expected). > > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Vlastimil Babka > Cc: Oscar Salvador > Cc: Mel Gorman > Cc: Mike Rapoport > Cc: Dan Williams > Cc: Wei Yang > Cc: Alexander Duyck > Cc: Anshuman Khandual > Cc: Pavel Tatashin > Signed-off-by: David Hildenbrand Acked-by: Michal Hocko We still set PageReserved before onlining pages and that one should be good to go as well (memmap_init_zone). Thanks! There is a comment above offline_isolated_pages_cb that should be removed as well. > --- > mm/page_alloc.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index ed8884dc0c47..bf6b21f02154 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -8667,7 +8667,7 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) > { > struct page *page; > struct zone *zone; > - unsigned int order, i; > + unsigned int order; > unsigned long pfn; > unsigned long flags; > unsigned long offlined_pages = 0; > @@ -8695,7 +8695,6 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) > */ > if (unlikely(!PageBuddy(page) && PageHWPoison(page))) { > pfn++; > - SetPageReserved(page); > offlined_pages++; > continue; > } > @@ -8709,8 +8708,6 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) > pfn, 1 << order, end_pfn); > #endif > del_page_from_free_area(page, &zone->free_area[order]); > - for (i = 0; i < (1 << order); i++) > - SetPageReserved((page+i)); > pfn += (1 << order); > } > spin_unlock_irqrestore(&zone->lock, flags); > -- > 2.21.0 > -- Michal Hocko SUSE Labs