The patch titled Subject: mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8 has been added to the -mm tree. Its filename is mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Arun KS <arunks@xxxxxxxxxxxxxx> Subject: mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8 - Fixed onlined_pages accounting. - Added comment for return value of online_page_callback. - Renamed xen_bring_pgs_online to xen_online_pages. Link: http://lkml.kernel.org/r/1547032395-24582-1-git-send-email-arunks@xxxxxxxxxxxxxx Signed-off-by: Arun KS <arunks@xxxxxxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx> Cc: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/xen/balloon.c | 8 ++++---- mm/memory_hotplug.c | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) --- a/drivers/xen/balloon.c~mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8 +++ a/drivers/xen/balloon.c @@ -345,8 +345,8 @@ static enum bp_state reserve_additional_ /* * add_memory_resource() will call online_pages() which in its turn - * will call xen_bring_pgs_online() callback causing deadlock if we - * don't release balloon_mutex here. Unlocking here is safe because the + * will call xen_online_pages() callback causing deadlock if we don't + * release balloon_mutex here. Unlocking here is safe because the * callers drop the mutex before trying again. */ mutex_unlock(&balloon_mutex); @@ -369,7 +369,7 @@ static enum bp_state reserve_additional_ return BP_ECANCELED; } -static int xen_bring_pgs_online(struct page *pg, unsigned int order) +static int xen_online_pages(struct page *pg, unsigned int order) { unsigned long i, size = (1 << order); unsigned long start_pfn = page_to_pfn(pg); @@ -709,7 +709,7 @@ static int __init balloon_init(void) balloon_stats.max_retry_count = RETRY_UNLIMITED; #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG - set_online_page_callback(&xen_bring_pgs_online); + set_online_page_callback(&xen_online_pages); register_memory_notifier(&xen_memory_nb); register_sysctl_table(xen_root); #endif --- a/mm/memory_hotplug.c~mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8 +++ a/mm/memory_hotplug.c @@ -676,6 +676,13 @@ static int online_pages_blocks(unsigned order = min(MAX_ORDER - 1, get_order(PFN_PHYS(end) - PFN_PHYS(start))); + /* + * External callback providers can deny onlining pages. So check + * for return value. + * zero : if all pages are onlined. + * positive : if only few pages are onlined. + * negative : if none of the pages are onlined. + */ ret = (*online_page_callback)(pfn_to_page(start), order); if (!ret) onlined_pages += (1UL << order); @@ -697,7 +704,7 @@ static int online_pages_range(unsigned l online_mem_sections(start_pfn, start_pfn + nr_pages); - *(unsigned long *)arg = onlined_pages; + *(unsigned long *)arg += onlined_pages; return 0; } _ Patches currently in -mm which might be from arunks@xxxxxxxxxxxxxx are memory_hotplug-free-pages-as-higher-order.patch mm-page_allocc-memory_hotplug-free-pages-as-higher-order-v8.patch