Re: [PATCH] mm:vmscan: shrink skip folios in the exiting task

From: zhiguojiang
Date: Wed Jan 24 2024 - 20:35:08 EST




在 2024/1/24 21:20, Matthew Wilcox 写道:
On Wed, Jan 24, 2024 at 08:43:07PM +0800, Zhiguo Jiang wrote:
If the shrinking folio is belong to the exiting task, this folio should
be freed in the task exit flow rather than being reclaimed in the shrink
flow, because the former takes less time.

If the folio which is belong to the exiting task is reclaimed in the
shrink flow, such as the anon folio, the anon folio needs to be first
written to the swap partition by swap-in in shrink flow, and then the
corresponding swap folio needs to be released in the task exiting flow.
As is well known, releasing a swap folio will task more time than
releasing directly an anon folio.

In the scenarios of the low memory system and mutil backed-applications,
the time-consuming problem caused by shrinking the exiting task's folios
will be more severe.
What testing have you done of this patch? How often does it happen?
Are there particular workloads that benefit from this? (I'm not sure
what "mutil backed-applications" are?)
1 Yes, this patch has been tested.

2 When the exiting tasks and shrink_inactive_list occur at the same time,
   the folios which shrink_inactive_list reclaims may be the exiting tasks's folios
   in lruvecs. And when system is low memory, it more likely to occur, because
   more backend applidatuions will be killed.
   The shrink_inactive_list reclaims the exiting tasks's folios in lruvecs and
   transforms the exiting tasks's anon folios into swap memory, which leads
   to the increasing load of the current exiting tasks.

3 This patch can alleviate the load of the tasks exiting process. This patch
   can make that the exiting tasks release its anon folios faster instead of
   releasing its swap memory from its anon folios swap-in in shrink_inactive_list.

4 "mutil backed-applications" means that there are a large number of
    the backend applications in the system.

Thanks

And I do mean specifically of this patch, because to my eyes it
shouldn't even compile.
Has been tested.