[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220412135912.93175db2ab4e83f4bb060dbf@linux-foundation.org>
Date: Tue, 12 Apr 2022 13:59:12 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Sudarshan Rajagopalan <quic_sudaraja@...cinc.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Mike Rapoport <rppt@...ux.ibm.com>,
Anshuman Khandual <anshuman.khandual@....com>,
Suren Baghdasaryan <surenb@...gle.com>
Subject: Re: [PATCH] mm, page_alloc: check pfn is valid before moving to
freelist
On Tue, 12 Apr 2022 13:16:23 -0700 Sudarshan Rajagopalan <quic_sudaraja@...cinc.com> wrote:
> Check if pfn is valid before or not before moving it to freelist.
>
> There are possible scenario where a pageblock can have partial physical
> hole and partial part of System RAM. This happens when base address in RAM
> partition table is not aligned to pageblock size.
>
> ...
>
>
> Signed-off-by: Sudarshan Rajagopalan <quic_sudaraja@...cinc.com>
> Fixes: 4c7b9896621be ("mm: remove pfn_valid_within() and CONFIG_HOLES_IN_ZONE")
I made that 859a85ddf90e714092dea71a0e54c7b9896621be and added
cc:stable. I'll await reviewer input before proceeding further.
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2521,6 +2521,11 @@ static int move_freepages(struct zone *zone,
> int pages_moved = 0;
>
> for (pfn = start_pfn; pfn <= end_pfn;) {
> + if (!pfn_valid(pfn)) {
Readers will wonder how we can encounter an invalid pfn here. A small
comment might help clue them in.
> + pfn++;
> + continue;
> + }
> +
> page = pfn_to_page(pfn);
> if (!PageBuddy(page)) {
> /*
Powered by blists - more mailing lists