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

From: David Rientjes
Date: Wed Feb 24 2016 - 16:33:56 EST


On Wed, 24 Feb 2016, Chen Yucong wrote:

> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index c832ef3..e4b6dec3 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1059,10 +1059,9 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
>
> ret = memory_notify(MEM_GOING_ONLINE, &arg);
> ret = notifier_to_errno(ret);
> - if (ret) {
> - memory_notify(MEM_CANCEL_ONLINE, &arg);
> - return ret;
> - }
> + if (ret)
> + goto failed_addition;
> +
> /*
> * If this zone is not populated, then it is not in zonelist.
> * This means the page allocator ignores this zone.
> @@ -1080,12 +1079,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
> if (need_zonelists_rebuild)
> zone_pcp_reset(zone);
> mutex_unlock(&zonelists_mutex);
> - printk(KERN_DEBUG "online_pages [mem %#010llx-%#010llx] failed\n",
> - (unsigned long long) pfn << PAGE_SHIFT,
> - (((unsigned long long) pfn + nr_pages)
> - << PAGE_SHIFT) - 1);
> - memory_notify(MEM_CANCEL_ONLINE, &arg);
> - return ret;
> + goto failed_addition;
> }
>
> zone->present_pages += onlined_pages;
> @@ -1118,6 +1112,13 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
> if (onlined_pages)
> memory_notify(MEM_ONLINE, &arg);
> return 0;
> +
> +failed_addition:
> + pr_info("online_pages [mem %#010llx-%#010llx] failed\n",
> + (unsigned long long) pfn << PAGE_SHIFT,
> + (((unsigned long long) pfn + nr_pages) << PAGE_SHIFT) - 1);
> + memory_notify(MEM_CANCEL_ONLINE, &arg);
> + return ret;
> }
> #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
>

Please explain how the conversion from KERN_DEBUG to KERN_INFO level is
better?

If the onlining returns an error value, which it will, why do we need to
leave an artifact behind in the kernel log that it failed?