Re: [PATCH] mm, memory hotplug: print more failure information for online_pages

From: David Rientjes
Date: Wed Feb 24 2016 - 20:43:05 EST


On Thu, 25 Feb 2016, Chen Yucong wrote:

> > Please explain how the conversion from KERN_DEBUG to KERN_INFO level is
> > better?
>
> Like __offline_pages(), printk() in online_pages() is used for reporting
> an failed addition rather than debug information.
> Another reason is that pr_debug() is not an exact equivalent of
> printk(KERN_DEBUG ...)
>
> /* If you are writing a driver, please use dev_dbg instead */
> #if defined(CONFIG_DYNAMIC_DEBUG)
> /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here
> */
> #define pr_debug(fmt, ...) \
> dynamic_pr_debug(fmt, ##__VA_ARGS__)
> #elif defined(DEBUG)
> #define pr_debug(fmt, ...) \
> printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> #else
> #define pr_debug(fmt, ...) \
> no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> #endif
>

My question is why in either __offline_pages() (today's code) or
__online_pages() (your patch) we would want to leave behind a message in
the kernel log to indicate failure? I don't think it's helpful to spam
the kernel log with unnecessary information when onlining or offlining
failed. Userspace already knows the range that it attempted to online or
offline, it already has the correct error value, why spam it?

A patch to move __offline_pages() to not print this with KERN_INFO would
make more sense.