linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ruihan Li <lrh2000@pku.edu.cn>
To: Mike Rapoport <rppt@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Ruihan Li <lrh2000@pku.edu.cn>
Subject: Re: [PATCH] mm/mm_init: Don't iterate pages below ARCH_PFN_OFFSET
Date: Sat, 19 Apr 2025 20:08:22 +0800	[thread overview]
Message-ID: <6f2sjssx6f4lidlhucdio45s6p7d6xr4ibr3n3f73z53x5u62e@hvyh5socmfll> (raw)
In-Reply-To: <aANN0rwxcajUtFXs@kernel.org>

Hi Mike,

Thanks a lot for your review!

On Sat, Apr 19, 2025 at 10:16:34AM +0300, Mike Rapoport wrote:
> On Sat, Apr 19, 2025 at 12:27:27AM +0800, Ruihan Li wrote:
> > Currently, memmap_init initializes pfn_hole with 0 instead of
> > ARCH_PFN_OFFSET. Then init_unavailable_range will start iterating each
> > page from the page at address zero to the first available page, but it
> > won't do anything for pages below ARCH_PFN_OFFSET because pfn_valid
> > won't pass.
> > 
> > If ARCH_PFN_OFFSET is very large (e.g., something like 2^64-2GiB if the
> > kernel is used as a library and loaded at a very high address), the
> > pointless iteration for pages below ARCH_PFN_OFFSET will take a very
> > long time, and the kernel will look stuck at boot time.
> > 
> > This commit sets the initial value of pfn_hole to ARCH_PFN_OFFSET, which
> > avoids the problematic and useless iteration mentioned above.
> > 
> > Fixes: 907ec5fca3dc ("mm: zero remaining unavailable struct pages")
> 
> I don't think it should be backported, this does not fix a bug.

I thought the Fixes tag only indicated that the problem existed since
the specific commit, not the need for a backport (since the backport
should only happen when someone sends or CC's the patch to the
linux-stable mailing list)?

But anyway, I'm going to remove the Fixes tag when I send v2.

> 
> > Signed-off-by: Ruihan Li <lrh2000@pku.edu.cn>
> > ---
> >  mm/mm_init.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/mm_init.c b/mm/mm_init.c
> > index 84f14fa12..b3ae9f797 100644
> > --- a/mm/mm_init.c
> > +++ b/mm/mm_init.c
> > @@ -966,7 +966,7 @@ static void __init memmap_init_zone_range(struct zone *zone,
> >  static void __init memmap_init(void)
> >  {
> >  	unsigned long start_pfn, end_pfn;
> > -	unsigned long hole_pfn = 0;
> > +	unsigned long hole_pfn = ARCH_PFN_OFFSET;
> 
> ARCH_PFN_OFFSET is defined only for FLATMEM, this won't even build for
> SPARSEMEM.

Sorry for my ignorance. I'm not familiar with the code and I'm only
testing the FLATMEM configuration. I'll send a v2 patch to fix this.
Thanks for pointing out my stupid mistake.

> 
> >  	int i, j, zone_id = 0, nid;
> >  
> >  	for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
> > -- 
> > 2.49.0
> > 
> > 
> 
> -- 
> Sincerely yours,
> Mike.

Thanks,
Ruihan Li



  reply	other threads:[~2025-04-19 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18 16:27 Ruihan Li
2025-04-19  7:16 ` Mike Rapoport
2025-04-19 12:08   ` Ruihan Li [this message]
2025-04-19 10:56 ` kernel test robot
2025-04-19 11:06 ` kernel test robot

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=6f2sjssx6f4lidlhucdio45s6p7d6xr4ibr3n3f73z53x5u62e@hvyh5socmfll \
    --to=lrh2000@pku.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    /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