mm/memory_hotplug: export mhp_supports_memmap_on_memory()
[linux-2.6-microblaze.git] / mm / memory_hotplug.c
index 707027f..a444e2d 100644 (file)
@@ -1337,7 +1337,7 @@ static inline bool arch_supports_memmap_on_memory(unsigned long vmemmap_size)
 }
 #endif
 
-static bool mhp_supports_memmap_on_memory(unsigned long size)
+bool mhp_supports_memmap_on_memory(void)
 {
        unsigned long vmemmap_size = memory_block_memmap_size();
        unsigned long memmap_pages = memory_block_memmap_on_memory_pages();
@@ -1346,17 +1346,11 @@ static bool mhp_supports_memmap_on_memory(unsigned long size)
         * Besides having arch support and the feature enabled at runtime, we
         * need a few more assumptions to hold true:
         *
-        * a) We span a single memory block: memory onlining/offlinin;g happens
-        *    in memory block granularity. We don't want the vmemmap of online
-        *    memory blocks to reside on offline memory blocks. In the future,
-        *    we might want to support variable-sized memory blocks to make the
-        *    feature more versatile.
-        *
-        * b) The vmemmap pages span complete PMDs: We don't want vmemmap code
+        * a) The vmemmap pages span complete PMDs: We don't want vmemmap code
         *    to populate memory from the altmap for unrelated parts (i.e.,
         *    other memory blocks)
         *
-        * c) The vmemmap pages (and thereby the pages that will be exposed to
+        * b) The vmemmap pages (and thereby the pages that will be exposed to
         *    the buddy) have to cover full pageblocks: memory onlining/offlining
         *    code requires applicable ranges to be page-aligned, for example, to
         *    set the migratetypes properly.
@@ -1368,7 +1362,7 @@ static bool mhp_supports_memmap_on_memory(unsigned long size)
         *       altmap as an alternative source of memory, and we do not exactly
         *       populate a single PMD.
         */
-       if (!mhp_memmap_on_memory() || size != memory_block_size_bytes())
+       if (!mhp_memmap_on_memory())
                return false;
 
        /*
@@ -1391,6 +1385,7 @@ static bool mhp_supports_memmap_on_memory(unsigned long size)
 
        return arch_supports_memmap_on_memory(vmemmap_size);
 }
+EXPORT_SYMBOL_GPL(mhp_supports_memmap_on_memory);
 
 static void __ref remove_memory_blocks_and_altmaps(u64 start, u64 size)
 {
@@ -1526,7 +1521,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
         * Self hosted memmap array
         */
        if ((mhp_flags & MHP_MEMMAP_ON_MEMORY) &&
-           mhp_supports_memmap_on_memory(memory_block_size_bytes())) {
+           mhp_supports_memmap_on_memory()) {
                ret = create_altmaps_and_memory_blocks(nid, group, start, size, mhp_flags);
                if (ret)
                        goto error;