Re: [PATCH v2 03/10] mm/memory_hotplug: simplify page offlining

From: Michal Hocko
Date: Fri Sep 04 2020 - 03:46:56 EST


On Fri 04-09-20 07:47:45, David Hildenbrand wrote:
>
>
> > Am 03.09.2020 um 23:58 schrieb Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>:
[...]
> > @@ -1589,16 +1567,27 @@ int __ref offline_pages(unsigned long st
> > reason = "failure to dissolve huge pages";
> > goto failed_removal_isolated;
> > }
> > - /* check again */
> > - ret = walk_system_ram_range(start_pfn, end_pfn - start_pfn,
> > - NULL, check_pages_isolated_cb);
> > - } while (ret);
> > -
> > - /* Ok, all of our target is isolated.
> > - We cannot do rollback at this point. */
> > - walk_system_ram_range(start_pfn, end_pfn - start_pfn,
> > - &offlined_pages, offline_isolated_pages_cb);
> > - pr_info("Offlined Pages %ld\n", offlined_pages);
> > +
> > + /*
> > + * per-cpu pages are drained in start_isolate_page_range, but if
> > + * there are still pages that are not free, make sure that we
> > + * drain again, because when we isolated range we might
> > + * have raced with another thread that was adding pages to pcp
> > + * list.
> > + *
> > + * Forward progress should be still guaranteed because
> > + * pages on the pcp list can only belong to MOVABLE_ZONE
> > + * because has_unmovable_pages explicitly checks for
> > + * PageBuddy on freed pages on other zones.
> > + */
> > + if (ret)
> > + drain_all_pages(zone);
> > + } while (test_pages_isolated(start_pfn, end_pfn, MEMORY_OFFLINE));
>
> I think we have to do
>
> ret = test_pages_isolated()
> if (ret)

Yes.
--
Michal Hocko
SUSE Labs