From: Shakeel Butt <shakeel.butt@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@surriel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, Vinay Banakar <vny@google.com>,
liuye <liuye@kylinos.cn>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@techsingularity.net>,
Yu Zhao <yuzhao@google.com>
Subject: Re: [PATCH v2] mm/vmscan: batch TLB flush during memory reclaim
Date: Thu, 3 Apr 2025 15:31:03 -0700 [thread overview]
Message-ID: <7u3xvh3sz54xg7nii7lakwggpifv3ez7ffgmxjudj54bq463un@iyjjt5zosmup> (raw)
In-Reply-To: <20250403150055.94a38bc7e6e3f618fbc23ddd@linux-foundation.org>
On Thu, Apr 03, 2025 at 03:00:55PM -0700, Andrew Morton wrote:
> On Fri, 28 Mar 2025 14:20:55 -0400 Rik van Riel <riel@surriel.com> wrote:
>
> > The current implementation in shrink_folio_list() performs a full TLB
> > flush for every individual folio reclaimed. This causes unnecessary
> > overhead during memory reclaim.
> >
> > The current code:
> > 1. Clears PTEs and unmaps each page individually
> > 2. Performs a full TLB flush on every CPU the mm is running on
> >
> > The new code:
> > 1. Clears PTEs and unmaps each page individually
> > 2. Adds each unmapped page to pageout_folios
> > 3. Flushes the TLB once before procesing pageout_folios
> >
> > This reduces the number of TLB flushes issued by the memory reclaim
> > code by 1/N, where N is the number of mapped folios encountered in
> > the batch processed by shrink_folio_list.
>
> Were any runtime benefits observable?
Andrew, can you hold off this patch for now? I provided some feedback
privately but let me put it here as well.
This patch is very very hard to review. shrink_folio_list() has become a
beast over the years. This patch is moving a code block within the same
function and skipping a lot of stuff happening between the old place and
the new place. I still couldn't figure out how the actual freeing of
folios are happening as the patch completely skips
mem_cgroup_uncharge_folios() & free_unref_folios(). Also the lazyfree
counters are skipped. In addition buffer head, swap free, mlocked
handling will be skipped as well.
I think there is a need to explain why this patch is correct even with
skipping all those functionalities.
next prev parent reply other threads:[~2025-04-03 22:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 18:20 Rik van Riel
2025-04-03 22:00 ` Andrew Morton
2025-04-03 22:31 ` Shakeel Butt [this message]
2025-04-04 13:30 ` Vinay Banakar
2025-04-04 13:37 ` Vinay Banakar
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=7u3xvh3sz54xg7nii7lakwggpifv3ez7ffgmxjudj54bq463un@iyjjt5zosmup \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
--cc=mgorman@techsingularity.net \
--cc=riel@surriel.com \
--cc=vny@google.com \
--cc=yuzhao@google.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