Re: memory offline infinite loop after soft offline

From: Michal Hocko
Date: Fri Oct 18 2019 - 07:34:41 EST


On Fri 18-10-19 13:00:45, David Hildenbrand wrote:
> On 18.10.19 10:55, Michal Hocko wrote:
> > On Fri 18-10-19 10:38:21, David Hildenbrand wrote:
> > > On 18.10.19 10:24, Michal Hocko wrote:
> > > > On Fri 18-10-19 10:13:36, David Hildenbrand wrote:
> > > > [...]
> > > > > However, if the compound page spans multiple pageblocks
> > > >
> > > > Although hugetlb pages spanning pageblocks are possible this shouldn't
> > > > matter in__test_page_isolated_in_pageblock because this function doesn't
> > > > really operate on pageblocks as the name suggests. It is simply
> > > > traversing all valid RAM ranges (see walk_system_ram_range).
> > >
> > > As long as the hugepages don't span memory blocks/sections, you are right. I
> > > have no experience with gigantic pages in this regard.
> >
> > They can clearly span sections (1GB is larger than 128MB). Why do you
> > think it matters actually? walk_system_ram_range walks RAM ranges and no
> > allocation should span holes in RAM right?
> >
>
> Let's explore what I was thinking. If we can agree that any compound page is
> always aligned to its size , then what I tell here is not applicable. I know
> it is true for gigantic pages.
>
> Some extreme example to clarify
>
> [ memory block 0 (128MB) ][ memory block 1 (128MB) ]
> [ compound page (128MB) ]
>
> If you would offline memory block 1, and you detect PG_offline on the first
> page of that memory block (PageHWPoison(compound_head(page))), you would
> jump over the whole memory block (pfn += 1 << compound_order(page)), leaving
> 64MB of the memory block unchecked.
>
> Again, if any compound page has the alignment restrictions (PFN of head
> aligned to 1 << compound_order(page)), this is not possible.
>
>
> If it is, however, possible, the "clean" thing would be to only jump over
> the remaining part of the compound page, e.g., something like
>
> pfn += (1 << compound_order(page)) - (page - compound_head(page)));

OK, I see what you mean now. In other words similar to eeb0efd071d82.
--
Michal Hocko
SUSE Labs