Re: [PATCH] mm/vmscan: Fix hard LOCKUP in function isolate_lru_folios

From: liuye
Date: Wed Sep 25 2024 - 05:53:50 EST




On 2024/9/25 下午5:29, Andrew Morton wrote:
> On Wed, 25 Sep 2024 16:37:14 +0800 liuye <liuye@xxxxxxxxxx> wrote:
>
>>
>>
>> On 2024/9/25 上午8:22, Andrew Morton wrote:
>>> On Wed, 14 Aug 2024 17:18:25 +0800 liuye <liuye@xxxxxxxxxx> wrote:
>>>
>>>> @@ -1669,10 +1670,12 @@ static unsigned long isolate_lru_folios(unsigned long nr_to_scan,
>>>> nr_pages = folio_nr_pages(folio);
>>>> total_scan += nr_pages;
>>>>
>>>> - if (folio_zonenum(folio) > sc->reclaim_idx ||
>>>> - skip_cma(folio, sc)) {
>>>> + /* Using max_nr_skipped to prevent hard LOCKUP*/
>>>> + if ((max_nr_skipped < SWAP_CLUSTER_MAX_SKIPPED) &&
>>>> + (folio_zonenum(folio) > sc->reclaim_idx || skip_cma(folio, sc))) {
>>>> nr_skipped[folio_zonenum(folio)] += nr_pages;
>>>> move_to = &folios_skipped;
>>>> + max_nr_skipped++;
>>>> goto move;
>>>
>>> This hunk is not applicable to current mainline.
>>>
>>
>> Please see the PATCH v2 in link [1], and the related discussion in link [2].
>> Then please explain why it is not applicable,thank you.
>
> What I mean is that the patch doesn't apply.
>
> Current mainline has
>
> if (folio_zonenum(folio) > sc->reclaim_idx) {
> nr_skipped[folio_zonenum(folio)] += nr_pages;
> move_to = &folios_skipped;
> goto move;
> }
>

PATCH v2 base on current mainline.

@@ -1650,9 +1651,12 @@ static unsigned long isolate_lru_folios(unsigned long nr_to_scan,
nr_pages = folio_nr_pages(folio);
total_scan += nr_pages;

- if (folio_zonenum(folio) > sc->reclaim_idx) {
+ /* Using max_nr_skipped to prevent hard LOCKUP*/
+ if (max_nr_skipped < SWAP_CLUSTER_MAX_SKIPPED &&
+ (folio_zonenum(folio) > sc->reclaim_idx)) {
nr_skipped[folio_zonenum(folio)] += nr_pages;
move_to = &folios_skipped;
+ max_nr_skipped++;
goto move;
}