mm: move is_pageblock_removable_nolock() to mm/memory_hotplug.c
authorMathieu Malaterre <malat@debian.org>
Fri, 8 Jun 2018 00:07:43 +0000 (17:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Jun 2018 00:34:36 +0000 (17:34 -0700)
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@debian.org
Signed-off-by: Mathieu Malaterre <malat@debian.org>
Suggested-by: Michal Hocko <mhocko@kernel.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/memory_hotplug.h
mm/memory_hotplug.c
mm/page_alloc.c

index 2b0265265c286b9fffb53e290039bf0686046908..4e9828cda7a26ee6796b127c06a35513bd5a29d1 100644 (file)
@@ -107,7 +107,6 @@ static inline bool movable_node_is_enabled(void)
 }
 
 #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,
index 25982467800b35756ad1eaf31a8782aaa52e0318..7deb49f69e276b7fba6768b12bbfe9648476599e 100644 (file)
@@ -1237,6 +1237,29 @@ static struct page *next_active_pageblock(struct page *page)
        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)
 {
index b93cc79a8db4244d5348ed5c3b001f16b514d8fa..d0d26da120863d57b54349f1fb9dcfd7d8c38ff2 100644 (file)
@@ -7692,29 +7692,6 @@ unmovable:
        return true;
 }
 
-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)