Re: [PATCH 00/10] [v7][RESEND] Migrate Pages in lieu of discard

From: Huang, Ying
Date: Tue Apr 20 2021 - 22:39:22 EST


Michal Hocko <mhocko@xxxxxxxx> writes:

> On Fri 16-04-21 07:26:43, Dave Hansen wrote:
>> On 4/16/21 5:35 AM, Michal Hocko wrote:
>> > - Anonymous pages are bit tricky because they can be demoted even when
>> > they cannot be reclaimed due to no (or no available) swap storage.
>> > Unless I have missed something the second round will try to reclaim
>> > them even the later is true and I am not sure this is completely OK.
>>
>> What we want is something like this:
>>
>> Swap Space / Demotion OK -> Can Reclaim
>> Swap Space / Demotion Off -> Can Reclaim
>> Swap Full / Demotion OK -> Can Reclaim
>> Swap Full / Demotion Off -> No Reclaim
>>
>> I *think* that's what can_reclaim_anon_pages() ends up doing. Maybe I'm
>> misunderstanding what you are referring to, though. By "second round"
>> did you mean when we do reclaim on a node which is a terminal node?
>
> No, I mean the migration failure case where you splice back to the page
> list to reclaim. In that round you do not demote and want to reclaim.
> But a lack of swap space will make that page unreclaimable. I suspect
> this would just work out fine but I am not sure from the top of my head.

I have tested this via injecting some migration errors (returning 0 from
demote_page_list() before migration) on a system without swap. The
system can still work properly. In ftrace, I can find add_to_swap() are
called much more times, and it can deal with the situation where the
swap space isn't available.

Best Regards,
Huang, Ying