From: David Hildenbrand <david@redhat.com>
To: Wei Yang <richard.weiyang@gmail.com>,
rppt@kernel.org, akpm@linux-foundation.org
Cc: shivankg@amd.com, linux-mm@kvack.org
Subject: Re: [PATCH] mm/mm_init.c: use round_up() to calculate usermap size
Date: Wed, 12 Feb 2025 18:09:16 +0100 [thread overview]
Message-ID: <bf164418-7623-47b8-8e20-f0462114a902@redhat.com> (raw)
In-Reply-To: <20250212013818.873-1-richard.weiyang@gmail.com>
On 12.02.25 02:38, Wei Yang wrote:
> Since pageblock_nr_pages and BITS_PER_LONG are power of 2, we could use
> round_up() to calculate it.
>
> Also we have renamed blockflags to pageblock_flags, adjust the comment
> accordingly.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> Suggested-by: Shivank Garg <shivankg@amd.com>
> ---
> mm/mm_init.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 3ec50b5fda12..550d5ae98cfd 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1459,7 +1459,7 @@ void __meminit init_currently_empty_zone(struct zone *zone,
>
> #ifndef CONFIG_SPARSEMEM
> /*
> - * Calculate the size of the zone->blockflags rounded to an unsigned long
> + * Calculate the size of the zone->pageblock_flags rounded to an unsigned long
> * Start by making sure zonesize is a multiple of pageblock_order by rounding
> * up. Then use 1 NR_PAGEBLOCK_BITS worth of bits per pageblock, finally
> * round what is now in bits to nearest long in bits, then return it in
> @@ -1470,10 +1470,10 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l
> unsigned long usemapsize;
>
> zonesize += zone_start_pfn & (pageblock_nr_pages-1);
> - usemapsize = roundup(zonesize, pageblock_nr_pages);
> + usemapsize = round_up(zonesize, pageblock_nr_pages);
> usemapsize = usemapsize >> pageblock_order;
> usemapsize *= NR_PAGEBLOCK_BITS;
> - usemapsize = roundup(usemapsize, BITS_PER_LONG);
> + usemapsize = round_up(usemapsize, BITS_PER_LONG);
>
> return usemapsize / BITS_PER_BYTE;
> }
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-02-12 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 1:38 Wei Yang
2025-02-12 4:30 ` Shivank Garg
2025-02-12 17:09 ` David Hildenbrand [this message]
2025-02-13 4:35 ` Anshuman Khandual
2025-02-13 6:32 ` 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=bf164418-7623-47b8-8e20-f0462114a902@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.com \
--cc=rppt@kernel.org \
--cc=shivankg@amd.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