linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vinay Banakar <vny@google.com>
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, liuye <liuye@kylinos.cn>,
	Hugh Dickins <hughd@google.com>,
	 Mel Gorman <mgorman@techsingularity.net>,
	Yu Zhao <yuzhao@google.com>,
	 Shakeel Butt <shakeel.butt@linux.dev>
Subject: Re: [PATCH v2] mm/vmscan: batch TLB flush during memory reclaim
Date: Fri, 4 Apr 2025 08:30:58 -0500	[thread overview]
Message-ID: <CALf+9Ye_870=X_s+jvK7rToQhuo=JV_Nr8vjVh_Vua2CSm_yHA@mail.gmail.com> (raw)
In-Reply-To: <20250403150055.94a38bc7e6e3f618fbc23ddd@linux-foundation.org>

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

On Thu, Apr 3, 2025 at 5:00 PM Andrew Morton <akpm@linux-foundation.org>
wrote:
> Were any runtime benefits observable?

I had replied as follows on another chain related to this patch:

Yes, the patch reduces IPIs by a factor of 512 by sending one IPI (for TLB
flush) per PMD rather than per page. Since shrink_folio_list()
usually operates on one PMD at a time, I believe we can safely batch these
operations here, but I would appreciate your feedback on this.

Here's a concrete example:
When swapping out 20 GiB (5.2M pages):
- Current: Each page triggers an IPI to all cores
  - With 6 cores: 31.4M total interrupts (6 cores × 5.2M pages)
- With patch: One IPI per PMD (512 pages)
  - Only 10.2K IPIs required (5.2M/512)
  - With 6 cores: 61.4K total interrupts
  - Results in ~99% reduction in total interrupts

Application performance impact varies by workload, but here's a
representative test case:
- Thread 1: Continuously accesses a 2 GiB private anonymous map (64B
chunks at random offsets)
- Thread 2: Pinned to different core, uses MADV_PAGEOUT on 20 GiB
private anonymous map to swap it out to SSD
- The threads only access their respective maps.
Results:
  - Without patch: Thread 1 sees ~53% throughput reduction during
swap. If there are multiple worker threads (like thread 1), the
cumulative throughput degradation will be much higher
  - With patch: Thread 1 maintains normal throughput

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

  parent reply	other threads:[~2025-04-04 13: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
2025-04-04 13:30   ` Vinay Banakar [this message]
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='CALf+9Ye_870=X_s+jvK7rToQhuo=JV_Nr8vjVh_Vua2CSm_yHA@mail.gmail.com' \
    --to=vny@google.com \
    --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=shakeel.butt@linux.dev \
    --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