]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - arch/powerpc/platforms/pseries/hotplug-memory.c
memory-hotplug: suppress "Trying to free nonexistent resource <XXXXXXXXXXXXXXXX-YYYYY...
[linux-imx.git] / arch / powerpc / platforms / pseries / hotplug-memory.c
index 11d8e0544ac0f52a09f0f8692d7a3c265f00a353..dc0a035e63bb5c549adbfa58660b15ef16abec90 100644 (file)
@@ -77,7 +77,8 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
 {
        unsigned long start, start_pfn;
        struct zone *zone;
-       int ret;
+       int i, ret;
+       int sections_to_remove;
 
        start_pfn = base >> PAGE_SHIFT;
 
@@ -97,9 +98,13 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
         * to sysfs "state" file and we can't remove sysfs entries
         * while writing to it. So we have to defer it to here.
         */
-       ret = __remove_pages(zone, start_pfn, memblock_size >> PAGE_SHIFT);
-       if (ret)
-               return ret;
+       sections_to_remove = (memblock_size >> PAGE_SHIFT) / PAGES_PER_SECTION;
+       for (i = 0; i < sections_to_remove; i++) {
+               unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
+               ret = __remove_pages(zone, start_pfn,  PAGES_PER_SECTION);
+               if (ret)
+                       return ret;
+       }
 
        /*
         * Update memory regions for memory remove