[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2d778151-9b8c-4be8-a4d3-bafcc1f09778@linux.alibaba.com>
Date: Thu, 20 Jun 2024 16:26:33 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Yu Zhao <yuzhao@...gle.com>
Cc: akpm@...ux-foundation.org, hughd@...gle.com, willy@...radead.org,
david@...hat.com, wangkefeng.wang@...wei.com, chrisl@...nel.org,
ying.huang@...el.com, 21cnbao@...il.com, ryan.roberts@....com,
shy828301@...il.com, ziy@...dia.com, ioworker0@...il.com,
da.gomez@...sung.com, p.raghav@...sung.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/9] mm: vmscan: add validation before spliting shmem
large folio
On 2024/6/20 14:12, Yu Zhao wrote:
> On Tue, Jun 18, 2024 at 12:54 AM Baolin Wang
> <baolin.wang@...ux.alibaba.com> wrote:
>>
>> Add swap available space validation before spliting shmem large folio to
>> avoid redundant split, since we can not write shmem folio to the swap device
>> in this case.
>
> We don't scan anon LRU unless we know we may be able to swap. Even if
> there is swap space, we may still not be able to swap. See
> can_reclaim_anon_pages().
Right. Another case is MADV_PAGEOUT can still split a large shmem folio
even without a swap device. I know this is not a common case, and I can
drop this patch if it is less helpful.
Thanks for your input.
>> Signed-off-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
>> ---
>> mm/vmscan.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 1807e5d95dda..61465f92283f 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1237,6 +1237,14 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>> }
>> } else if (folio_test_swapbacked(folio) &&
>> folio_test_large(folio)) {
>> +
>> + /*
>> + * Do not split shmem folio if no swap memory
>> + * available.
>> + */
>> + if (!total_swap_pages)
>> + goto activate_locked;
>> +
>> /* Split shmem folio */
>> if (split_folio_to_list(folio, folio_list))
>> goto keep_locked;
>> --
>> 2.39.3
>>
>>
Powered by blists - more mailing lists