io_uring: remove io_free_req_tw
[platform/kernel/linux-starfive.git] / mm / memory_hotplug.c
index db3b270..8e0fa20 100644 (file)
@@ -596,7 +596,7 @@ static void online_pages_range(unsigned long start_pfn, unsigned long nr_pages)
        unsigned long pfn;
 
        /*
-        * Online the pages in MAX_ORDER - 1 aligned chunks. The callback might
+        * Online the pages in MAX_ORDER aligned chunks. The callback might
         * decide to not expose all pages to the buddy (e.g., expose them
         * later). We account all pages as being online and belonging to this
         * zone ("present").
@@ -605,7 +605,18 @@ static void online_pages_range(unsigned long start_pfn, unsigned long nr_pages)
         * this and the first chunk to online will be pageblock_nr_pages.
         */
        for (pfn = start_pfn; pfn < end_pfn;) {
-               int order = min(MAX_ORDER - 1UL, __ffs(pfn));
+               int order;
+
+               /*
+                * Free to online pages in the largest chunks alignment allows.
+                *
+                * __ffs() behaviour is undefined for 0. start == 0 is
+                * MAX_ORDER-aligned, Set order to MAX_ORDER for the case.
+                */
+               if (pfn)
+                       order = min_t(int, MAX_ORDER, __ffs(pfn));
+               else
+                       order = MAX_ORDER;
 
                (*online_page_callback)(pfn_to_page(pfn), order);
                pfn += (1UL << order);