The patch titled Subject: mm: move is_pageblock_removable_nolock() to mm/memory_hotplug.c has been added to the -mm tree. Its filename is mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc.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: Mathieu Malaterre <malat@xxxxxxxxxx> Subject: mm: move is_pageblock_removable_nolock() to mm/memory_hotplug.c is_pageblock_removable_nolock() is not used outside of mm/memory_hotplug.c. Move it next to unique caller is_mem_section_removable() and make it static. Remove prototype in <linux/memory_hotplug.h> to silence gcc warning (W=1): mm/page_alloc.c:7704:6: warning: no previous prototype for `is_pageblock_removable_nolock' [-Wmissing-prototypes] Link: http://lkml.kernel.org/r/20180509190001.24789-1-malat@xxxxxxxxxx Signed-off-by: Mathieu Malaterre <malat@xxxxxxxxxx> Suggested-by: Michal Hocko <mhocko@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memory_hotplug.h | 1 - mm/memory_hotplug.c | 23 +++++++++++++++++++++++ mm/page_alloc.c | 23 ----------------------- 3 files changed, 23 insertions(+), 24 deletions(-) diff -puN include/linux/memory_hotplug.h~mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc include/linux/memory_hotplug.h --- a/include/linux/memory_hotplug.h~mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc +++ a/include/linux/memory_hotplug.h @@ -107,7 +107,6 @@ static inline bool movable_node_is_enabl } #ifdef CONFIG_MEMORY_HOTREMOVE -extern bool is_pageblock_removable_nolock(struct page *page); extern int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap); extern int __remove_pages(struct zone *zone, unsigned long start_pfn, diff -puN mm/memory_hotplug.c~mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc mm/memory_hotplug.c --- a/mm/memory_hotplug.c~mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc +++ a/mm/memory_hotplug.c @@ -1237,6 +1237,29 @@ static struct page *next_active_pagebloc return page + pageblock_nr_pages; } +static bool is_pageblock_removable_nolock(struct page *page) +{ + struct zone *zone; + unsigned long pfn; + + /* + * We have to be careful here because we are iterating over memory + * sections which are not zone aware so we might end up outside of + * the zone but still within the section. + * We have to take care about the node as well. If the node is offline + * its NODE_DATA will be NULL - see page_zone. + */ + if (!node_online(page_to_nid(page))) + return false; + + zone = page_zone(page); + pfn = page_to_pfn(page); + if (!zone_spans_pfn(zone, pfn)) + return false; + + return !has_unmovable_pages(zone, page, 0, MIGRATE_MOVABLE, true); +} + /* Checks if this range of memory is likely to be hot-removable. */ bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) { diff -puN mm/page_alloc.c~mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc mm/page_alloc.c --- a/mm/page_alloc.c~mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc +++ a/mm/page_alloc.c @@ -7710,29 +7710,6 @@ bool has_unmovable_pages(struct zone *zo return false; } -bool is_pageblock_removable_nolock(struct page *page) -{ - struct zone *zone; - unsigned long pfn; - - /* - * We have to be careful here because we are iterating over memory - * sections which are not zone aware so we might end up outside of - * the zone but still within the section. - * We have to take care about the node as well. If the node is offline - * its NODE_DATA will be NULL - see page_zone. - */ - if (!node_online(page_to_nid(page))) - return false; - - zone = page_zone(page); - pfn = page_to_pfn(page); - if (!zone_spans_pfn(zone, pfn)) - return false; - - return !has_unmovable_pages(zone, page, 0, MIGRATE_MOVABLE, true); -} - #if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA) static unsigned long pfn_max_align_down(unsigned long pfn) _ Patches currently in -mm which might be from malat@xxxxxxxxxx are mm-slubc-add-__printf-verification-to-slab_err.patch mm-move-is_pageblock_removable_nolock-to-mm-memory_hotplugc.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html