linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Some printk cleanup in mm
@ 2014-03-26 23:49 Mitchel Humpherys
  2014-03-26 23:49 ` [PATCH] mm: convert some level-less printks to pr_* Mitchel Humpherys
  0 siblings, 1 reply; 5+ messages in thread
From: Mitchel Humpherys @ 2014-03-26 23:49 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, Matt Mackall, linux-mm
  Cc: linux-kernel, Mitchel Humpherys

This series cleans up some printks in the mm code that were missing
log levels.

Mitchel Humpherys (1):
  mm: convert some level-less printks to pr_*

 mm/bounce.c    |  5 +++--
 mm/mempolicy.c |  3 ++-
 mm/mmap.c      | 19 ++++++++++---------
 mm/nommu.c     |  3 ++-
 mm/slub.c      |  7 ++++---
 mm/vmscan.c    |  3 ++-
 6 files changed, 23 insertions(+), 17 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] mm: convert some level-less printks to pr_*
  2014-03-26 23:49 [PATCH] Some printk cleanup in mm Mitchel Humpherys
@ 2014-03-26 23:49 ` Mitchel Humpherys
  2014-03-27  0:07   ` Joe Perches
  2014-03-27  0:38   ` Christoph Lameter
  0 siblings, 2 replies; 5+ messages in thread
From: Mitchel Humpherys @ 2014-03-26 23:49 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, Matt Mackall, linux-mm
  Cc: linux-kernel, Mitchel Humpherys

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.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
 mm/bounce.c    |  5 +++--
 mm/mempolicy.c |  3 ++-
 mm/mmap.c      | 19 ++++++++++---------
 mm/nommu.c     |  3 ++-
 mm/slub.c      |  7 ++++---
 mm/vmscan.c    |  3 ++-
 6 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/mm/bounce.c b/mm/bounce.c
index 523918b8c6..7fca8ef660 100644
--- a/mm/bounce.c
+++ b/mm/bounce.c
@@ -15,6 +15,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 +35,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("bounce pool size: %d pages\n", POOL_SIZE);
 
 	return 0;
 }
@@ -86,7 +87,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 bounce pool size: %d pages\n", ISA_POOL_SIZE);
 	return 0;
 }
 
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index ae3c8f3595..81ae17cf92 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -91,6 +91,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>
@@ -2751,7 +2752,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_warn("numa_policy_init: interleaving failed\n");
 
 	check_numabalancing_enable();
 }
diff --git a/mm/mmap.c b/mm/mmap.c
index 20ff0c3327..52f85997e0 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -36,6 +36,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>
@@ -360,20 +361,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;
@@ -387,7 +388,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;
@@ -422,17 +423,17 @@ 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);
@@ -3237,7 +3238,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_info("Failed registering memory add/remove notifier for admin reserve");
 
 	return 0;
 }
diff --git a/mm/nommu.c b/mm/nommu.c
index 8740213b16..331dede25f 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -30,6 +30,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>
@@ -1241,7 +1242,7 @@ error_free:
 	return ret;
 
 enomem:
-	printk("Allocation of length %lu from process %d (%s) failed\n",
+	pr_warn("Allocation of length %lu from process %d (%s) failed\n",
 	       len, current->pid, current->comm);
 	show_free_areas(0);
 	return -ENOMEM;
diff --git a/mm/slub.c b/mm/slub.c
index 25f14ad8f8..58d98d6c7c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -33,6 +33,7 @@
 #include <linux/stacktrace.h>
 #include <linux/prefetch.h>
 #include <linux/memcontrol.h>
+#include <linux/printk.h>
 
 #include <trace/events/kmem.h>
 
@@ -1774,15 +1775,15 @@ static inline void note_cmpxchg_failure(const char *n,
 
 #ifdef CONFIG_PREEMPT
 	if (tid_to_cpu(tid) != tid_to_cpu(actual_tid))
-		printk("due to cpu change %d -> %d\n",
+		pr_info("due to cpu change %d -> %d\n",
 			tid_to_cpu(tid), tid_to_cpu(actual_tid));
 	else
 #endif
 	if (tid_to_event(tid) != tid_to_event(actual_tid))
-		printk("due to cpu running other code. Event %ld->%ld\n",
+		pr_info("due to cpu running other code. Event %ld->%ld\n",
 			tid_to_event(tid), tid_to_event(actual_tid));
 	else
-		printk("for unknown reason: actual=%lx was=%lx target=%lx\n",
+		pr_info("for unknown reason: actual=%lx was=%lx target=%lx\n",
 			actual_tid, tid, next_tid(tid));
 #endif
 	stat(s, CMPXCHG_DOUBLE_CPU_FAIL);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index a9c74b4096..67c3db4735 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -43,6 +43,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>
@@ -477,7 +478,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;
 			}
 		}
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: convert some level-less printks to pr_*
  2014-03-26 23:49 ` [PATCH] mm: convert some level-less printks to pr_* Mitchel Humpherys
@ 2014-03-27  0:07   ` Joe Perches
  2014-03-27  0:38   ` Christoph Lameter
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-03-27  0:07 UTC (permalink / raw)
  To: Mitchel Humpherys
  Cc: Christoph Lameter, Pekka Enberg, Matt Mackall, linux-mm,
	linux-kernel

On Wed, 2014-03-26 at 16:49 -0700, Mitchel Humpherys wrote:
> 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.

There are some defects in this patch:
Conversions of printk to pr_info that should be pr_cont.

I've also got some other trivial comments about it.

For each file modified, if it's not already there,
please add before any #include

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

[]

> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
[]
> @@ -2751,7 +2752,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_warn("numa_policy_init: interleaving failed\n");

That seems more like pr_err to me.

Also please remove embedded function names and use
"%s: ", __func__

> @@ -3237,7 +3238,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_info("Failed registering memory add/remove notifier for admin reserve");

Another more likely pr_err
Also missing a "\n" terminating newline

> diff --git a/mm/nommu.c b/mm/nommu.c
[]
> @@ -1241,7 +1242,7 @@ error_free:
>  	return ret;
>  
>  enomem:
> -	printk("Allocation of length %lu from process %d (%s) failed\n",
> +	pr_warn("Allocation of length %lu from process %d (%s) failed\n",
>  	       len, current->pid, current->comm);

pr_err

> diff --git a/mm/slub.c b/mm/slub.c
[]
> @@ -1774,15 +1775,15 @@ static inline void note_cmpxchg_failure(const char *n,
>  
>  #ifdef CONFIG_PREEMPT
>  	if (tid_to_cpu(tid) != tid_to_cpu(actual_tid))
> -		printk("due to cpu change %d -> %d\n",
> +		pr_info("due to cpu change %d -> %d\n",
>  			tid_to_cpu(tid), tid_to_cpu(actual_tid));

This should be pr_cont

>  	else
>  #endif
>  	if (tid_to_event(tid) != tid_to_event(actual_tid))
> -		printk("due to cpu running other code. Event %ld->%ld\n",
> +		pr_info("due to cpu running other code. Event %ld->%ld\n",

pr_cont

>  			tid_to_event(tid), tid_to_event(actual_tid));
>  	else
> -		printk("for unknown reason: actual=%lx was=%lx target=%lx\n",
> +		pr_info("for unknown reason: actual=%lx was=%lx target=%lx\n",

pr_cont

>  			actual_tid, tid, next_tid(tid));
>  #endif
>  	stat(s, CMPXCHG_DOUBLE_CPU_FAIL);


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: convert some level-less printks to pr_*
  2014-03-26 23:49 ` [PATCH] mm: convert some level-less printks to pr_* Mitchel Humpherys
  2014-03-27  0:07   ` Joe Perches
@ 2014-03-27  0:38   ` Christoph Lameter
  2014-03-27 16:10     ` Christoph Lameter
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2014-03-27  0:38 UTC (permalink / raw)
  To: Mitchel Humpherys; +Cc: Pekka Enberg, Matt Mackall, linux-mm, linux-kernel

On Wed, 26 Mar 2014, Mitchel Humpherys wrote:

> 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.

Acked-by: Christoph Lameter <cl@linux.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: convert some level-less printks to pr_*
  2014-03-27  0:38   ` Christoph Lameter
@ 2014-03-27 16:10     ` Christoph Lameter
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-03-27 16:10 UTC (permalink / raw)
  To: Mitchel Humpherys; +Cc: Pekka Enberg, Matt Mackall, linux-mm, linux-kernel

Would like to retracting the ack after seeing the other comments. Will ack
after then issues have been fixed.

On Wed, 26 Mar 2014, Christoph Lameter wrote:

> On Wed, 26 Mar 2014, Mitchel Humpherys wrote:
>
> > 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.
>
> Acked-by: Christoph Lameter <cl@linux.com>
>
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-27 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 23:49 [PATCH] Some printk cleanup in mm Mitchel Humpherys
2014-03-26 23:49 ` [PATCH] mm: convert some level-less printks to pr_* Mitchel Humpherys
2014-03-27  0:07   ` Joe Perches
2014-03-27  0:38   ` Christoph Lameter
2014-03-27 16:10     ` Christoph Lameter

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).