Commit 4abd32dbab201c3ced0b0af12accea77cd9eeffc

Authored by Andi Kleen
Committed by Linus Torvalds
1 parent 8faa8b077b

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: Adam Litke <agl@us.ibm.com>
Acked-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 16 additions and 4 deletions Side-by-side Diff

... ... @@ -1006,15 +1006,27 @@
1006 1006 }
1007 1007 }
1008 1008  
  1009 +static char * __init memfmt(char *buf, unsigned long n)
  1010 +{
  1011 + if (n >= (1UL << 30))
  1012 + sprintf(buf, "%lu GB", n >> 30);
  1013 + else if (n >= (1UL << 20))
  1014 + sprintf(buf, "%lu MB", n >> 20);
  1015 + else
  1016 + sprintf(buf, "%lu KB", n >> 10);
  1017 + return buf;
  1018 +}
  1019 +
1009 1020 static void __init report_hugepages(void)
1010 1021 {
1011 1022 struct hstate *h;
1012 1023  
1013 1024 for_each_hstate(h) {
1014   - printk(KERN_INFO "Total HugeTLB memory allocated, "
1015   - "%ld %dMB pages\n",
1016   - h->free_huge_pages,
1017   - 1 << (h->order + PAGE_SHIFT - 20));
  1025 + char buf[32];
  1026 + printk(KERN_INFO "HugeTLB registered %s page size, "
  1027 + "pre-allocated %ld pages\n",
  1028 + memfmt(buf, huge_page_size(h)),
  1029 + h->free_huge_pages);
1018 1030 }
1019 1031 }
1020 1032