linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <vbabka@suse.cz>, <sfr@canb.auug.org.au>, <peterz@infradead.org>,
	<mgorman@techsingularity.net>, <david@redhat.com>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linmiaohe@huawei.com>
Subject: [PATCH v2 2/5] mm/page_alloc.c: simplify the code by using macro K()
Date: Thu, 2 Sep 2021 20:12:39 +0800	[thread overview]
Message-ID: <20210902121242.41607-3-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210902121242.41607-1-linmiaohe@huawei.com>

Use helper macro K() to convert the pages to the corresponding size.
Minor readability improvement.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
 mm/page_alloc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index dbb3338d9287..d3983244f56f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8134,8 +8134,7 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char
 	}
 
 	if (pages && s)
-		pr_info("Freeing %s memory: %ldK\n",
-			s, pages << (PAGE_SHIFT - 10));
+		pr_info("Freeing %s memory: %ldK\n", s, K(pages));
 
 	return pages;
 }
@@ -8180,14 +8179,13 @@ void __init mem_init_print_info(void)
 		", %luK highmem"
 #endif
 		")\n",
-		nr_free_pages() << (PAGE_SHIFT - 10),
-		physpages << (PAGE_SHIFT - 10),
+		K(nr_free_pages()), K(physpages),
 		codesize >> 10, datasize >> 10, rosize >> 10,
 		(init_data_size + init_code_size) >> 10, bss_size >> 10,
-		(physpages - totalram_pages() - totalcma_pages) << (PAGE_SHIFT - 10),
-		totalcma_pages << (PAGE_SHIFT - 10)
+		K(physpages - totalram_pages() - totalcma_pages),
+		K(totalcma_pages)
 #ifdef	CONFIG_HIGHMEM
-		, totalhigh_pages() << (PAGE_SHIFT - 10)
+		, K(totalhigh_pages())
 #endif
 		);
 }
-- 
2.23.0


  parent reply	other threads:[~2021-09-02 12:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 12:12 [PATCH v2 0/5] Cleanups and fixup for page_alloc Miaohe Lin
2021-09-02 12:12 ` [PATCH v2 1/5] mm/page_alloc.c: remove meaningless VM_BUG_ON() in pindex_to_order() Miaohe Lin
2021-09-02 12:12 ` Miaohe Lin [this message]
2021-09-02 12:12 ` [PATCH v2 3/5] mm/page_alloc.c: fix obsolete comment in free_pcppages_bulk() Miaohe Lin
2021-09-02 14:03   ` Mel Gorman
2021-09-02 12:12 ` [PATCH v2 4/5] mm/page_alloc.c: use helper function zone_spans_pfn() Miaohe Lin
2021-09-02 12:12 ` [PATCH v2 5/5] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact[_nid] Miaohe Lin
2021-09-02 12:16   ` David Hildenbrand
2021-09-02 12:45     ` Miaohe Lin

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=20210902121242.41607-3-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=peterz@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).