linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: linux-mm@kvack.org, mgorman@techsingularity.net,
	akpm@linux-foundation.org
Subject: Re: [PATCH 2/2] mm, page_alloc: cleanup usemap_size() when SPARSEMEM is not set
Date: Fri, 7 Dec 2018 09:58:01 +0000	[thread overview]
Message-ID: <20181207095801.2s664cinhdk5vjql@master> (raw)
In-Reply-To: <20181205091905.27727-2-richard.weiyang@gmail.com>

On Wed, Dec 05, 2018 at 05:19:05PM +0800, Wei Yang wrote:
>Two cleanups in this patch:
>
>  * since pageblock_nr_pages == (1 << pageblock_order), the roundup()
>    and right shift pageblock_order could be replaced with
>    DIV_ROUND_UP()
>  * use BITS_TO_LONGS() to get number of bytes for bitmap
>
>This patch also fix one typo in comment.

Patch 1 maybe controversial, how about this one :-)

Look forward some comments.

>
>Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>---
> mm/page_alloc.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>index 7c745c305332..baf473f80800 100644
>--- a/mm/page_alloc.c
>+++ b/mm/page_alloc.c
>@@ -6204,7 +6204,7 @@ static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
> /*
>  * Calculate the size of the zone->blockflags 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
>+ * up. Then use 1 NR_PAGEBLOCK_BITS width of bits per pageblock, finally
>  * round what is now in bits to nearest long in bits, then return it in
>  * bytes.
>  */
>@@ -6213,12 +6213,9 @@ 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 = usemapsize >> pageblock_order;
>+	usemapsize = DIV_ROUND_UP(zonesize, pageblock_nr_pages);
> 	usemapsize *= NR_PAGEBLOCK_BITS;
>-	usemapsize = roundup(usemapsize, 8 * sizeof(unsigned long));
>-
>-	return usemapsize / 8;
>+	return BITS_TO_LONGS(usemapsize) * sizeof(unsigned long);
> }
> 
> static void __ref setup_usemap(struct pglist_data *pgdat,
>-- 
>2.15.1

-- 
Wei Yang
Help you, Help me

  reply	other threads:[~2018-12-07  9:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05  9:19 [PATCH 1/2] mm, pageblock: make sure pageblock won't exceed mem_sectioin Wei Yang
2018-12-05  9:19 ` [PATCH 2/2] mm, page_alloc: cleanup usemap_size() when SPARSEMEM is not set Wei Yang
2018-12-07  9:58   ` Wei Yang [this message]
2018-12-05 11:15 ` [PATCH 1/2] mm, pageblock: make sure pageblock won't exceed mem_sectioin Mel Gorman
2018-12-05 12:08   ` Wei Yang
2018-12-05 15:37     ` Mel Gorman
2018-12-05 22:31       ` Wei Yang
2018-12-06  9:00         ` David Hildenbrand
2018-12-06  9:21           ` Wei Yang
2018-12-06  9:26             ` David Hildenbrand
2018-12-06  9:42               ` Wei Yang
2018-12-08  1:42 ` kbuild test robot
2018-12-09 12:03   ` Wei Yang
2018-12-13  2:26     ` Rong Chen
2018-12-13  3:08       ` Wei Yang
2018-12-13  5:02         ` Rong Chen
2018-12-13  7:28           ` Wei Yang
2018-12-09 13:58 ` kbuild 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=20181207095801.2s664cinhdk5vjql@master \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    /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