public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/3] mm/mm_init.c: get the highest zone directly
Date: Mon, 3 Jun 2024 09:21:57 +0300	[thread overview]
Message-ID: <Zl1hBRcdJ_wdih2f@kernel.org> (raw)
In-Reply-To: <20240531002613.5231-1-richard.weiyang@gmail.com>

On Fri, May 31, 2024 at 12:26:11AM +0000, Wei Yang wrote:
> We have recorded nr_zones in pgdat, just get it directly.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  mm/mm_init.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index aa83105b3a1b..2bcf87eab0c6 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -2136,7 +2136,7 @@ static int __init deferred_init_memmap(void *data)
>  	unsigned long first_init_pfn, flags;
>  	unsigned long start = jiffies;
>  	struct zone *zone;
> -	int zid, max_threads;
> +	int max_threads;
>  	u64 i;
>  
>  	/* Bind memory initialisation thread to a local node if possible */
> @@ -2163,12 +2163,8 @@ static int __init deferred_init_memmap(void *data)
>  	 */
>  	pgdat_resize_unlock(pgdat, &flags);
>  
> -	/* Only the highest zone is deferred so find it */
> -	for (zid = 0; zid < MAX_NR_ZONES; zid++) {
> -		zone = pgdat->node_zones + zid;
> -		if (first_init_pfn < zone_end_pfn(zone))
> -			break;
> -	}
> +	/* Only the highest zone is deferred */
> +	zone = pgdat->node_zones + pgdat->nr_zones - 1;
>  
>  	/* If the zone is empty somebody else may have cleared out the zone */
>  	if (!deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn,
> @@ -2196,7 +2192,7 @@ static int __init deferred_init_memmap(void *data)
>  	}
>  zone_empty:
>  	/* Sanity check that the next zone really is unpopulated */
> -	WARN_ON(++zid < MAX_NR_ZONES && populated_zone(++zone));
> +	WARN_ON(pgdat->nr_zones < MAX_NR_ZONES && populated_zone(++zone));
>  
>  	pr_info("node %d deferred pages initialised in %ums\n",
>  		pgdat->node_id, jiffies_to_msecs(jiffies - start));
> -- 
> 2.34.1
> 

-- 
Sincerely yours,
Mike.


      parent reply	other threads:[~2024-06-03  6:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31  0:26 [PATCH 1/3] mm/mm_init.c: get the highest zone directly Wei Yang
2024-05-31  0:26 ` [PATCH 2/3] mm/mm_init.c: use deferred_init_mem_pfn_range_in_zone() to decide loop condition Wei Yang
2024-06-03  6:23   ` Mike Rapoport
2024-05-31  0:26 ` [PATCH 3/3] mm/mm_init.c: not always search next deferred_init_pfn from very beginning Wei Yang
2024-06-03  6:27   ` Mike Rapoport
2024-06-03 20:16     ` Wei Yang
2024-06-05  5:29       ` Mike Rapoport
2024-06-03  6:21 ` Mike Rapoport [this message]

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=Zl1hBRcdJ_wdih2f@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.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