linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Chris Li <chrisl@kernel.org>
Cc: Yosry Ahmed <yosry.ahmed@linux.dev>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Kairui Song <kasong@tencent.com>,
	Kemeng Shi	 <shikemeng@huaweicloud.com>,
	Nhat Pham <nphamcs@gmail.com>, Baoquan He	 <bhe@redhat.com>,
	Barry Song <baohua@kernel.org>,
	Chengming Zhou	 <chengming.zhou@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
		pratmal@google.com, sweettea@google.com, gthelen@google.com,
	weixugc@google.com
Subject: Re: [PATCH RFC] mm: ghost swapfile support for zswap
Date: Wed, 26 Nov 2025 21:34:17 -0500	[thread overview]
Message-ID: <56507d9b9210ef5f67715b81efd96fd809021a44.camel@surriel.com> (raw)
In-Reply-To: <CACePvbUCeEu3dkq-M5fL-k-bca2c_h8A4HTCmLvRaV1aFW5qnw@mail.gmail.com>

On Thu, 2025-11-27 at 06:07 +0400, Chris Li wrote:
> On Thu, Nov 27, 2025 at 1:59 AM Rik van Riel <riel@surriel.com>
> wrote:
> > 
> > On Tue, 2025-11-25 at 22:50 +0400, Chris Li wrote:
> > > 
> > > > - We still cannot do swapoff efficiently as we need to walk the
> > > > page
> > > >   tables (and some swap tables) to find and swapin all entries
> > > > in a
> > > >   swapfile. Not as important as other things, but worth
> > > > mentioning.
> > > 
> > > That need rmap for swap entries. It It is an independent issue.
> > > 
> > 
> > Wouldn't rmap for swap entries be more expensive than
> > simply always having indirection for swap entries that
> > are in use?
> 
> It might be, to be frank. I consider this pretty far and late in the
> stage of the game to evaluate the rmap and its alternatives. Do you
> agree?
> 
> I might or might not try the rmap for swap entry. Right now I don't
> have many data points nor insights.

On the contrary. I think we should at least do some
back of the envelope calculations to estimate the
overhead of the different proposed solutions.

With both Nhat's vswap, and your proposal to always
have swap indirection with a separate front end, and
several back ends, there is no need for swap rmap.

This is a good thing, because a single swap slot
could be referenced by dozens, hundreds, or even
thousands of page table entries, in the case of
forking servers. This creates complexity which is
probably best avoided.

Conceptually, Nhat's vswap, and your idea of having
always-on swap indirection seem to be the same thing.
> 
> > This sounds like an uncommon scenario, but it is
> > functionally identical to what is done to pages
> > during zswap writeback, where the page table entries
> > stay unchanged, and the swap page is simply moved
> > to another backend location.
> > 
> > Why implement two things, when we can have one
> > thing that does both, with no extra complexity
> > over what zswap writeback needs?
> 
> Let me ask you a clarifying question, then.
> 
> 1) What exactly are you trying to propose here in what project? VS or
> swap the pony?

In the past, when faced with competing code bases
like this, one thing that has worked well is for both
developers to send their code to the list, and then
for both developers to send each other suggestions
(or diffs) to improve each other's code.

Vswap and your always-on indirection seem to do
exactly the same thing. This seems like a good
opportunity to work together, and come up with
code that is better than any one person's code.

> 2) What stage of the code change do you have in mind should this
> change apply to?

I think it makes sense to get the hard design
problems resolved before committing to one
particular code design.

Spending months to resolve subtle bugs in a
code base, only to discover later that it does
not do exactly what is needed, is not the
greatest way to make progress.

> 
> I can't speak for VS,  I am open to embrace what you suggest in order
> to swap the pony project, that is after I understand it first.
> 
Once both Nhat and you understand each other's code,
and have suggestions for each other on how to improve
it, we will likely end up with a code base that looks
nicer than either of you would have done by yourselves.

The more perspectives, the better.


-- 
All Rights Reversed.


  reply	other threads:[~2025-11-27  2:40 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  9:31 Chris Li
2025-11-21 10:19 ` Nhat Pham
2025-11-22  1:52   ` Chris Li
2025-11-24 14:47     ` Nhat Pham
2025-11-25 18:26       ` Chris Li
2025-11-21 11:40 ` Johannes Weiner
2025-11-22  1:52   ` Chris Li
2025-11-22 10:29     ` Kairui Song
2025-11-24 15:35     ` Nhat Pham
2025-11-24 16:14     ` Rik van Riel
2025-11-24 17:26       ` Chris Li
2025-11-24 17:42         ` Rik van Riel
2025-11-24 17:58           ` Chris Li
2025-11-24 17:27     ` Johannes Weiner
2025-11-24 18:24       ` Chris Li
2025-11-24 19:32         ` Johannes Weiner
2025-11-25 19:27           ` Chris Li
2025-11-25 21:31             ` Johannes Weiner
2025-11-26 19:22               ` Chris Li
2025-11-26 21:52                 ` Rik van Riel
2025-11-27  1:52                   ` Chris Li
2025-11-27  2:26                     ` Rik van Riel
2025-11-27 19:09                       ` Chris Li
2025-11-28 20:46                         ` Nhat Pham
2025-11-29 20:38                           ` Chris Li
2025-12-01 16:43                             ` Johannes Weiner
2025-12-01 19:49                               ` Kairui Song
2025-12-02 17:02                                 ` Johannes Weiner
2025-12-02 20:48                                   ` Chris Li
2025-12-01 20:21                               ` Barry Song
2025-12-02 19:58                               ` Chris Li
2025-12-01 23:37                             ` Nhat Pham
2025-12-02 19:18                               ` Chris Li
2025-12-02 18:18               ` Nhat Pham
2025-12-02 21:07                 ` Chris Li
2025-11-24 19:32       ` Yosry Ahmed
2025-11-24 20:24         ` Nhat Pham
2025-11-25 18:50         ` Chris Li
2025-11-26 21:58           ` Rik van Riel
2025-11-27  2:07             ` Chris Li
2025-11-27  2:34               ` Rik van Riel [this message]
2025-11-25 18:14     ` Chris Li
2025-11-25 18:55       ` Johannes Weiner
2025-11-21 15:14 ` Yosry Ahmed
2025-11-22  1:52   ` Chris Li
2025-11-24 14:57     ` Nhat Pham
2025-11-22  9:59 ` Kairui Song
2025-11-22 13:58   ` Baoquan He
2025-12-02  2:56   ` Barry Song
2025-12-02  6:31     ` Baoquan He
2025-12-02 17:53       ` Nhat Pham
2025-12-02 21:01         ` Chris Li
2025-12-03  8:37 ` Yosry Ahmed
2025-12-03 20:02   ` Chris Li
2025-12-04  6:16     ` Yosry Ahmed
2025-12-04 10:11       ` Chris Li
2025-12-04 20:55         ` Yosry Ahmed
2025-12-05  8:56           ` Kairui Song

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=56507d9b9210ef5f67715b81efd96fd809021a44.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bhe@redhat.com \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=pratmal@google.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=sweettea@google.com \
    --cc=weixugc@google.com \
    --cc=yosry.ahmed@linux.dev \
    /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