mm: convert some level-less printks to pr_*
authorMitchel Humpherys <mitchelh@codeaurora.org>
Fri, 6 Jun 2014 21:38:30 +0000 (14:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Jun 2014 23:08:18 +0000 (16:08 -0700)
printk is meant to be used with an associated log level.  There are some
instances of printk scattered around the mm code where the log level is
missing.  Add a log level and adhere to suggestions by
scripts/checkpatch.pl by moving to the pr_* macros.

Also add the typical pr_fmt definition so that print statements can be
easily traced back to the modules where they occur, correlated one with
another, etc.  This will require the removal of some (now redundant)
prefixes on a few print statements.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
block/bounce.c
mm/mempolicy.c
mm/mmap.c
mm/nommu.c
mm/vmscan.c

index 523918b8c6dcbef6968c37e2fa38ee87a3b2518c..ab21ba203d5c7744f4da2afbba85ed45dde86b98 100644 (file)
@@ -3,6 +3,8 @@
  * - Split from highmem.c
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/mm.h>
 #include <linux/export.h>
 #include <linux/swap.h>
@@ -15,6 +17,7 @@
 #include <linux/hash.h>
 #include <linux/highmem.h>
 #include <linux/bootmem.h>
+#include <linux/printk.h>
 #include <asm/tlbflush.h>
 
 #include <trace/events/block.h>
@@ -34,7 +37,7 @@ static __init int init_emergency_pool(void)
 
        page_pool = mempool_create_page_pool(POOL_SIZE, 0);
        BUG_ON(!page_pool);
-       printk("bounce pool size: %d pages\n", POOL_SIZE);
+       pr_info("pool size: %d pages\n", POOL_SIZE);
 
        return 0;
 }
@@ -86,7 +89,7 @@ int init_emergency_isa_pool(void)
                                       mempool_free_pages, (void *) 0);
        BUG_ON(!isa_page_pool);
 
-       printk("isa bounce pool size: %d pages\n", ISA_POOL_SIZE);
+       pr_info("isa pool size: %d pages\n", ISA_POOL_SIZE);
        return 0;
 }
 
index 16bc9fa42998805f43fce4853b92d06d63ff963d..1c16c228f35ab12e77105561f7c7b20fb4db17bd 100644 (file)
@@ -65,6 +65,8 @@
    kernel is not always grateful with that.
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/mempolicy.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
@@ -91,6 +93,7 @@
 #include <linux/ctype.h>
 #include <linux/mm_inline.h>
 #include <linux/mmu_notifier.h>
+#include <linux/printk.h>
 
 #include <asm/tlbflush.h>
 #include <asm/uaccess.h>
@@ -2645,7 +2648,7 @@ void __init numa_policy_init(void)
                node_set(prefer, interleave_nodes);
 
        if (do_set_mempolicy(MPOL_INTERLEAVE, 0, &interleave_nodes))
-               printk("numa_policy_init: interleaving failed\n");
+               pr_err("%s: interleaving failed\n", __func__);
 
        check_numabalancing_enable();
 }
index ced5efcdd4b6c7763e7ab6435db128a638e78059..129b847d30cc35c8724cee63e924f69faaf542c6 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -6,6 +6,8 @@
  * Address space accounting code       <alan@lxorguk.ukuu.org.uk>
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/backing-dev.h>
@@ -37,6 +39,7 @@
 #include <linux/sched/sysctl.h>
 #include <linux/notifier.h>
 #include <linux/memory.h>
+#include <linux/printk.h>
 
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
@@ -361,20 +364,20 @@ static int browse_rb(struct rb_root *root)
                struct vm_area_struct *vma;
                vma = rb_entry(nd, struct vm_area_struct, vm_rb);
                if (vma->vm_start < prev) {
-                       printk("vm_start %lx prev %lx\n", vma->vm_start, prev);
+                       pr_info("vm_start %lx prev %lx\n", vma->vm_start, prev);
                        bug = 1;
                }
                if (vma->vm_start < pend) {
-                       printk("vm_start %lx pend %lx\n", vma->vm_start, pend);
+                       pr_info("vm_start %lx pend %lx\n", vma->vm_start, pend);
                        bug = 1;
                }
                if (vma->vm_start > vma->vm_end) {
-                       printk("vm_end %lx < vm_start %lx\n",
+                       pr_info("vm_end %lx < vm_start %lx\n",
                                vma->vm_end, vma->vm_start);
                        bug = 1;
                }
                if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) {
-                       printk("free gap %lx, correct %lx\n",
+                       pr_info("free gap %lx, correct %lx\n",
                               vma->rb_subtree_gap,
                               vma_compute_subtree_gap(vma));
                        bug = 1;
@@ -388,7 +391,7 @@ static int browse_rb(struct rb_root *root)
        for (nd = pn; nd; nd = rb_prev(nd))
                j++;
        if (i != j) {
-               printk("backwards %d, forwards %d\n", j, i);
+               pr_info("backwards %d, forwards %d\n", j, i);
                bug = 1;
        }
        return bug ? -1 : i;
@@ -423,17 +426,17 @@ static void validate_mm(struct mm_struct *mm)
                i++;
        }
        if (i != mm->map_count) {
-               printk("map_count %d vm_next %d\n", mm->map_count, i);
+               pr_info("map_count %d vm_next %d\n", mm->map_count, i);
                bug = 1;
        }
        if (highest_address != mm->highest_vm_end) {
-               printk("mm->highest_vm_end %lx, found %lx\n",
+               pr_info("mm->highest_vm_end %lx, found %lx\n",
                       mm->highest_vm_end, highest_address);
                bug = 1;
        }
        i = browse_rb(&mm->mm_rb);
        if (i != mm->map_count) {
-               printk("map_count %d rb %d\n", mm->map_count, i);
+               pr_info("map_count %d rb %d\n", mm->map_count, i);
                bug = 1;
        }
        BUG_ON(bug);
@@ -3280,7 +3283,7 @@ static struct notifier_block reserve_mem_nb = {
 static int __meminit init_reserve_notifier(void)
 {
        if (register_hotmemory_notifier(&reserve_mem_nb))
-               printk("Failed registering memory add/remove notifier for admin reserve");
+               pr_err("Failed registering memory add/remove notifier for admin reserve\n");
 
        return 0;
 }
index 85f8d6698d4872c62ce3d3a03504c314b029215e..b78e3a8f5ee74fca5db7ebaa260ebe2644f224f3 100644 (file)
@@ -13,6 +13,8 @@
  *  Copyright (c) 2007-2010 Paul Mundt <lethal@linux-sh.org>
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/vmacache.h>
@@ -32,6 +34,7 @@
 #include <linux/syscalls.h>
 #include <linux/audit.h>
 #include <linux/sched/sysctl.h>
+#include <linux/printk.h>
 
 #include <asm/uaccess.h>
 #include <asm/tlb.h>
@@ -1246,7 +1249,7 @@ error_free:
        return ret;
 
 enomem:
-       printk("Allocation of length %lu from process %d (%s) failed\n",
+       pr_err("Allocation of length %lu from process %d (%s) failed\n",
               len, current->pid, current->comm);
        show_free_areas(0);
        return -ENOMEM;
index f44476a415444c53de367d70668bb91fc459969a..71f23c0c1090c8f4041b2c738d40c616f4dd9185 100644 (file)
@@ -11,6 +11,8 @@
  *  Multiqueue VM started 5.8.00, Rik van Riel.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
@@ -43,6 +45,7 @@
 #include <linux/sysctl.h>
 #include <linux/oom.h>
 #include <linux/prefetch.h>
+#include <linux/printk.h>
 
 #include <asm/tlbflush.h>
 #include <asm/div64.h>
@@ -480,7 +483,7 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
                if (page_has_private(page)) {
                        if (try_to_free_buffers(page)) {
                                ClearPageDirty(page);
-                               printk("%s: orphaned page\n", __func__);
+                               pr_info("%s: orphaned page\n", __func__);
                                return PAGE_CLEAN;
                        }
                }