linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: 李培锋 <lipeifeng@oppo.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: 21cnbao@gmail.com, akpm@linux-foundation.org, david@redhat.com,
	osalvador@suse.de, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Minchan Kim <minchan@kernel.org>
Subject: Re: [PATCH v2 0/2] reclaim contended folios asynchronously instead of promoting them
Date: Fri, 8 Mar 2024 14:41:04 +0800	[thread overview]
Message-ID: <b28879d7-b955-44cc-bd51-0ddc7aa33ed5@oppo.com> (raw)
In-Reply-To: <ZeqajmATLj5gm6Bv@casper.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 2667 bytes --]


在 2024/3/8 12:56, Matthew Wilcox 写道:
> On Fri, Mar 08, 2024 at 11:11:24AM +0800,lipeifeng@oppo.com  wrote:
>> Commit 6d4675e60135 ("mm: don't be stuck to rmap lock on reclaim path")
>> prevents the reclaim path from becoming stuck on the rmap lock. However,
>> it reinserts those folios at the head of the LRU during shrink_folio_list,
>> even if those folios are very cold.
> This seems like a lot of new code.  Did you consider something simpler
> like this?
>
> Also, this is Minchan's patch you're complaining about.  Add him to the
> cc.
>
> +++ b/mm/vmscan.c
> @@ -817,6 +817,7 @@ enum folio_references {
>          FOLIOREF_RECLAIM,
>          FOLIOREF_RECLAIM_CLEAN,
>          FOLIOREF_KEEP,
> +       FOLIOREF_RESCAN,
>          FOLIOREF_ACTIVATE,
>   };
>
> @@ -837,9 +838,9 @@ static enum folio_references folio_check_references(struct folio *folio,
>          if (vm_flags & VM_LOCKED)
>                  return FOLIOREF_ACTIVATE;
>
> -       /* rmap lock contention: rotate */
> +       /* rmap lock contention: keep at the tail */
>          if (referenced_ptes == -1)
> -               return FOLIOREF_KEEP;
> +               return FOLIOREF_RESCAN;
>
>          if (referenced_ptes) {
>                  /*
> @@ -1164,6 +1165,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>                  case FOLIOREF_ACTIVATE:
>                          goto activate_locked;
>                  case FOLIOREF_KEEP:
> +               case FOLIOREF_RESCAN:
>                          stat->nr_ref_keep += nr_pages;
>                          goto keep_locked;
>                  case FOLIOREF_RECLAIM:
> @@ -1446,7 +1448,10 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>   keep_locked:
>                  folio_unlock(folio);
>   keep:
> -               list_add(&folio->lru, &ret_folios);
> +               if (references == FOLIOREF_RESCAN)
> +                       list_add(&folio->lru, &rescan_folios);
> +               else
> +                       list_add(&folio->lru, &ret_folios);
>                  VM_BUG_ON_FOLIO(folio_test_lru(folio) ||
>                                  folio_test_unevictable(folio), folio);
>          }

Actually, we have tested the implementation method you mentioned:

Putting back the contended-folios in the tail of LRU during 
shrink_folio_list

and rescan it in next shrink_folio_list.

In some cases, we found the another serious problems that more and more

contended-folios were piled up at the tail of the LRU, which caused to the

serious lowmem-situation, because none of folios isolated could be reclaimed

since lock-contended during shrink_folio_list.

[-- Attachment #2: Type: text/html, Size: 3587 bytes --]

  reply	other threads:[~2024-03-08  6:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  3:11 [PATCH v2 0/2] reclaim contended folios asynchronously instead of promoting them lipeifeng
2024-03-08  3:11 ` [PATCH v2 1/2] mm/rmap: provide folio_referenced with the options to try_lock or lock lipeifeng
2024-03-08  3:11 ` [PATCH v2 2/2] mm: vmscan: reclaim contended folios asynchronously instead of promoting them lipeifeng
2024-03-08  4:56 ` [PATCH v2 0/2] " Matthew Wilcox
2024-03-08  6:41   ` 李培锋 [this message]
2024-03-11 11:14     ` 李培锋
2024-03-12  9:22     ` 李培锋

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b28879d7-b955-44cc-bd51-0ddc7aa33ed5@oppo.com \
    --to=lipeifeng@oppo.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=osalvador@suse.de \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).