Commit 4abd32db authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

hugetlb: printk cleanup

- Reword sentence to clarify meaning with multiple options
- Add support for using GB prefixes for the page size
- Add extra printk to delayed > MAX_ORDER allocation code
Acked-by: default avatarAdam Litke <agl@us.ibm.com>
Acked-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8faa8b07
...@@ -1006,15 +1006,27 @@ static void __init hugetlb_init_hstates(void) ...@@ -1006,15 +1006,27 @@ static void __init hugetlb_init_hstates(void)
} }
} }
static char * __init memfmt(char *buf, unsigned long n)
{
if (n >= (1UL << 30))
sprintf(buf, "%lu GB", n >> 30);
else if (n >= (1UL << 20))
sprintf(buf, "%lu MB", n >> 20);
else
sprintf(buf, "%lu KB", n >> 10);
return buf;
}
static void __init report_hugepages(void) static void __init report_hugepages(void)
{ {
struct hstate *h; struct hstate *h;
for_each_hstate(h) { for_each_hstate(h) {
printk(KERN_INFO "Total HugeTLB memory allocated, " char buf[32];
"%ld %dMB pages\n", printk(KERN_INFO "HugeTLB registered %s page size, "
h->free_huge_pages, "pre-allocated %ld pages\n",
1 << (h->order + PAGE_SHIFT - 20)); memfmt(buf, huge_page_size(h)),
h->free_huge_pages);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment