Re: [PATCH] mm/compaction: count pages and stop correctly during page isolation.

From: Vlastimil Babka
Date: Fri Oct 30 2020 - 10:55:49 EST


On 10/30/20 3:49 PM, Michal Hocko wrote:
On Fri 30-10-20 10:35:43, Zi Yan wrote:
On 30 Oct 2020, at 9:36, Michal Hocko wrote:

> On Fri 30-10-20 08:20:50, Zi Yan wrote:
>> On 30 Oct 2020, at 5:43, Michal Hocko wrote:
>>
>>> [Cc Vlastimil]
>>>
>>> On Thu 29-10-20 16:04:35, Zi Yan wrote:
>>>
>>> Does thp_nr_pages work for __PageMovable pages?
>>
>> Yes. It is the same as compound_nr() but compiled
>> to 1 when THP is not enabled.
>
> I am sorry but I do not follow. First of all the implementation of the
> two is different and also I was asking about __PageMovable which should
> never be THP IIRC. Can they be compound though?

__PageMovable, non-lru movable pages, can be compound and thp_nr_page cannot
be used for it, since when THP is off, thp_nr_page will return the wrong number.
I got confused by its name, sorry.

OK, this matches my understanding. Good we are on the same page.

But __PageMovable is irrelevant to this patch, since we are using
__isolate_lru_page to isolate pages. non-lru __PageMovable should not appear
after isolate_succes. thp_nr_pages can be used here.

But this is still not clear to me. __PageMovable pages are isolated by
isolate_movable_page and then jump to isolate_succes. Does that somehow
changes the nature of the page being compound or tat thp_nr_page would
start working on those pages.

Agreed that page movable can appear after isolate_success. compound_nr() should work for both.
Note that too_many_isolated() doesn't see __PageMovable isolated pages, as they are not counted as NR_ISOLATED_FILE/NR_ISOLATED_ANON, AFAIK. So in that sense they are irrelevant to the bug at hand... for now.