From: Michal Hocko <mhocko@kernel.org>
To: David Hildenbrand <david@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
Oscar Salvador <osalvador@suse.de>,
Mel Gorman <mgorman@techsingularity.net>,
Mike Rapoport <rppt@linux.ibm.com>,
Dan Williams <dan.j.williams@intel.com>,
Wei Yang <richard.weiyang@gmail.com>,
Alexander Duyck <alexander.h.duyck@linux.intel.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Pavel Tatashin <pavel.tatashin@microsoft.com>
Subject: Re: [PATCH v1 1/2] mm/page_alloc.c: Don't set pages PageReserved() when offlining
Date: Mon, 21 Oct 2019 16:43:45 +0200 [thread overview]
Message-ID: <20191021144345.GT9379@dhcp22.suse.cz> (raw)
In-Reply-To: <20191021141927.10252-2-david@redhat.com>
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 <akpm@linux-foundation.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Mike Rapoport <rppt@linux.ibm.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Wei Yang <richard.weiyang@gmail.com>
> Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Pavel Tatashin <pavel.tatashin@microsoft.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
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
next prev parent reply other threads:[~2019-10-21 14:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 14:19 [PATCH v1 0/2] mm: Memory offlining + page isolation cleanups David Hildenbrand
2019-10-21 14:19 ` [PATCH v1 1/2] mm/page_alloc.c: Don't set pages PageReserved() when offlining David Hildenbrand
2019-10-21 14:43 ` Michal Hocko [this message]
2019-10-21 15:39 ` David Hildenbrand
2019-10-21 15:47 ` Michal Hocko
2019-10-21 15:54 ` David Hildenbrand
2019-10-22 8:20 ` Michal Hocko
2019-10-22 8:23 ` David Hildenbrand
2019-10-22 8:58 ` Michal Hocko
2019-10-22 9:03 ` David Hildenbrand
2019-10-21 14:19 ` [PATCH v1 2/2] mm/page_isolation.c: Convert SKIP_HWPOISON to MEMORY_OFFLINE David Hildenbrand
2019-10-21 15:02 ` Michal Hocko
2019-10-21 15:04 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191021144345.GT9379@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=osalvador@suse.de \
--cc=pavel.tatashin@microsoft.com \
--cc=richard.weiyang@gmail.com \
--cc=rppt@linux.ibm.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox