From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sudarshan Rajagopalan <quic_sudaraja@quicinc.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Mike Rapoport <rppt@linux.ibm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Suren Baghdasaryan <surenb@google.com>
Subject: Re: [PATCH] mm, page_alloc: check pfn is valid before moving to freelist
Date: Tue, 12 Apr 2022 14:05:51 -0700 (PDT) [thread overview]
Message-ID: <6daaaf5c-529d-f3eb-7486-a72cabb6e396@google.com> (raw)
In-Reply-To: <20220412135912.93175db2ab4e83f4bb060dbf@linux-foundation.org>
On Tue, 12 Apr 2022, Andrew Morton wrote:
> On Tue, 12 Apr 2022 13:16:23 -0700 Sudarshan Rajagopalan <quic_sudaraja@quicinc.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@quicinc.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.
>
Acked-by: David Rientjes <rientjes@google.com>
> > --- 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.
>
Sudarshan can correct me if I'm wrong, but this has to do with the
pageblock alignment of the caller that assumes all pages in the range has
an underlying struct page that we can access but that fails to hold true
when we have a memory hole. A comment would definitely help:
/* Pageblock alignment may cause us to try to access into a hole */
> > + pfn++;
> > + continue;
> > + }
> > +
> > page = pfn_to_page(pfn);
> > if (!PageBuddy(page)) {
> > /*
>
>
>
next prev parent reply other threads:[~2022-04-12 21:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 20:16 Sudarshan Rajagopalan
2022-04-12 20:16 ` Sudarshan Rajagopalan
2022-04-12 20:59 ` Andrew Morton
2022-04-12 21:05 ` David Rientjes [this message]
2022-04-13 20:55 ` Mike Rapoport
2022-04-14 14:02 ` David Hildenbrand
2022-04-13 20:48 ` Mike Rapoport
2022-04-14 21:00 ` Sudarshan Rajagopalan
2022-04-18 7:24 ` Mike Rapoport
2022-04-18 22:32 ` Sudarshan Rajagopalan
2022-04-19 6:45 ` Mike Rapoport
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=6daaaf5c-529d-f3eb-7486-a72cabb6e396@google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=quic_sudaraja@quicinc.com \
--cc=rppt@linux.ibm.com \
--cc=surenb@google.com \
/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