linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vinay Banakar <vny@google.com>
To: Byungchul Park <byungchul@sk.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 willy@infradead.org
Cc: akpm@linux-foundation.org, mgorman@suse.de,
	Wei Xu <weixugc@google.com>,  Greg Thelen <gthelen@google.com>,
	kernel_team@skhynix.com
Subject: Re: [PATCH] mm: Optimize TLB flushes during page reclaim
Date: Tue, 21 Jan 2025 12:03:20 -0600	[thread overview]
Message-ID: <CALf+9YcyxRisLbPqn0uy-tRhtUFWNxjyzxSwyONmNe2AV-EV=Q@mail.gmail.com> (raw)
In-Reply-To: <20250121014359.GA60549@system.software.com>

On Mon, Jan 20, 2025 at 7:44 PM Byungchul Park <byungchul@sk.com> wrote:
> The *interesting* IPIs will be reduced by 1/512 at most.  Can we see the
improvement number?

Yes, we reduce IPIs by a factor of 512 by sending one IPI (for TLB
flush) per PMD rather than per page. Since shrink_folio_list()
operates on one PMD at a time, I believe we can safely batch these
operations here.

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

I expect a similar application performance impact when memory reclaim
is triggered by kswapd.


  reply	other threads:[~2025-01-21 18:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20 22:47 Vinay Banakar
2025-01-21  0:05 ` Vinay Banakar
2025-01-22  8:59   ` Bharata B Rao
2025-01-22 11:09     ` Vinay Banakar
2025-01-22 11:31       ` Bharata B Rao
2025-01-22 13:28         ` Vinay Banakar
2025-01-22 20:05           ` SeongJae Park
2025-01-23 17:11             ` Vinay Banakar
2025-01-23 17:23               ` SeongJae Park
2025-01-23 18:17               ` Matthew Wilcox
2025-01-21  1:43 ` Byungchul Park
2025-01-21 18:03   ` Vinay Banakar [this message]
2025-01-23  4:17 ` Rik van Riel
2025-01-23 19:16   ` Vinay Banakar
2025-01-28 22:01     ` Rik van Riel
2025-03-17 19:20     ` Rik van Riel

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+9YcyxRisLbPqn0uy-tRhtUFWNxjyzxSwyONmNe2AV-EV=Q@mail.gmail.com' \
    --to=vny@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=byungchul@sk.com \
    --cc=gthelen@google.com \
    --cc=kernel_team@skhynix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=weixugc@google.com \
    --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