Re: [PATCH] mm: convert some level-less printks to pr_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]