Skip to content

Commit

Permalink
mm/page_alloc.c: simplify the code by using macro K()
Browse files Browse the repository at this point in the history
Use helper macro K() to convert the pages to the corresponding size.
Minor readability improvement.

Link: https://lkml.kernel.org/r/20210902121242.41607-3-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Miaohe Lin authored and Linus Torvalds committed Nov 6, 2021
1 parent ea808b4 commit ff7ed9e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8130,8 +8130,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;
}
Expand Down Expand Up @@ -8176,14 +8175,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
);
}
Expand Down

0 comments on commit ff7ed9e

Please sign in to comment.