From: David Hildenbrand <david@redhat.com>
To: Zhiguo Jiang <justinjiang@vivo.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: Re: [PATCH] mm: vmscan: the dirty folio unmap redundantly
Date: Thu, 19 Oct 2023 15:03:32 +0200 [thread overview]
Message-ID: <904094ce-e340-4bb7-b50d-6aedd816e569@redhat.com> (raw)
In-Reply-To: <20231018013004.1569-1-justinjiang@vivo.com>
On 18.10.23 03:30, Zhiguo Jiang wrote:
> If the dirty folio is not reclaimed in the shrink process, it do
> not need to unmap, which can save shrinking time during traversaling
> the dirty folio.
Hi,
I really cannot understand what you mean with "the dirty folio unmap
redundantly". No clue what this patch is supposed to tackle by staring
at the patch subject.
This patch is supposed to improve performance. Can you provide some
proof that it does and that we should even care about this change?
>
> Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com>
> ---
> mm/vmscan.c | 72 +++++++++++++++++++++++++++--------------------------
> 1 file changed, 37 insertions(+), 35 deletions(-)
> mode change 100644 => 100755 mm/vmscan.c
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 2cc0cb41fb32..cf555cdfcefc
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1261,6 +1261,43 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
> enum ttu_flags flags = TTU_BATCH_FLUSH;
> bool was_swapbacked = folio_test_swapbacked(folio);
>
> + if (folio_test_dirty(folio)) {
> + /*
> + * Only kswapd can writeback filesystem folios
> + * to avoid risk of stack overflow. But avoid
> + * injecting inefficient single-folio I/O into
> + * flusher writeback as much as possible: only
> + * write folios when we've encountered many
> + * dirty folios, and when we've already scanned
> + * the rest of the LRU for clean folios and see
> + * the same dirty folios again (with the reclaim
> + * flag set).
> + */
> + if (folio_is_file_lru(folio) &&
> + (!current_is_kswapd() ||
> + !folio_test_reclaim(folio) ||
> + !test_bit(PGDAT_DIRTY, &pgdat->flags))) {
> + /*
> + * Immediately reclaim when written back.
> + * Similar in principle to folio_deactivate()
> + * except we already have the folio isolated
> + * and know it's dirty
> + */
> + node_stat_mod_folio(folio, NR_VMSCAN_IMMEDIATE,
> + nr_pages);
> + folio_set_reclaim(folio);
> +
> + goto activate_locked;
> + }
> +
> + if (references == FOLIOREF_RECLAIM_CLEAN)
> + goto keep_locked;
> + if (!may_enter_fs(folio, sc->gfp_mask))
> + goto keep_locked;
> + if (!sc->may_writepage)
> + goto keep_locked;
> + }
> +
> if (folio_test_pmd_mappable(folio))
> flags |= TTU_SPLIT_HUGE_PMD;
>
> @@ -1286,41 +1323,6 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>
> mapping = folio_mapping(folio);
> if (folio_test_dirty(folio)) {
Can you elaborate why we want to remove below code? It would have made
sense to me to duplicate the code in an early check before unmap, if the
folio is already dirty before checking all PTEs. But why can we remove
that post-unmap code?
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-10-19 13:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 1:30 Zhiguo Jiang
2023-10-18 14:12 ` Matthew Wilcox
2023-10-19 1:27 ` 答复: " 江志国
2023-10-19 13:03 ` David Hildenbrand [this message]
2023-10-19 13:23 ` zhiguojiang
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=904094ce-e340-4bb7-b50d-6aedd816e569@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=justinjiang@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=opensource.kernel@vivo.com \
/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