Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Lorenzo Stoakes <ljs@kernel.org>, lsf-pc@lists.linux-foundation.org
Cc: linux-mm@kvack.org, David Hildenbrand <david@kernel.org>,
	"Liam R. Howlett"	 <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Pedro Falcato <pfalcato@suse.de>,
	Ryan Roberts <ryan.roberts@arm.com>,
	 Harry Yoo <harry.yoo@oracle.com>, Jann Horn <jannh@google.com>,
	Chris Li <chriscli@google.com>,  Barry Song <baohua@kernel.org>
Subject: Re: [LSF/MM/BPF TOPIC] The Future of the Anonymous Reverse Mapping [RESEND]
Date: Sun, 03 May 2026 14:26:36 -0400	[thread overview]
Message-ID: <8c729d621f281dd0b1a891f4aaccb0ba4956b219.camel@surriel.com> (raw)
In-Reply-To: <afWcMyc5M4vViLJd@lucifer>

On Sat, 2026-05-02 at 07:53 +0100, Lorenzo Stoakes wrote:
> As is time-honoured LSF tradition, I am sharing code for my proposal.
> 
> I worked a very long day yesterday and got the _very_ rough PoC code
> into
> some kind of vaguely shareable state.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/ljs/linux.git/log/?h=project/cow-context
> 
> CAVEATS:
> 
> * The code is not great, it's 'experimental, wave your arms, hope for
> the
>   best' stuff used for experimentation.

First, some refcounting that confuses me.

The changelog, and the code in dup_cow_context
shows that only the parent's cow context gets
an increased refcount.

However, the code in __put_cow_context seems
to unconditionally decrement refcounts all up
the hierarchy, instead of bailing out once it
encounters a parent that still has a non-zero
refcount.

How is that supposed to work?

Now, having the remaps array cloned at fork
time does make the refcounting on that side
a lot simpler. I like that.

However, it does raise another question.

Say we have process A, with child process B.

Process A has memory mapped at address X.

Process B munmaps memory at address X, and
then maps new memory at address X.

If I haven't missed something important, the
remap table does not need to get used, because 
the offset and the virtual address match.

How does the COW walk handle that situation?

Overall, I like that you are trying to tackle
the problems associated with anon_vma, but
have to wonder if this implementation will
be able to avoid some of the complexity 
inherent in the problem space.

-- 
All Rights Reversed.


  reply	other threads:[~2026-05-03 18:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 21:23 [LSF/MM/BPF TOPIC] The Future of the Anonymous Reverse Mapping [RESEND] Lorenzo Stoakes (Oracle)
2026-03-31 23:30 ` Barry Song
2026-04-01  8:43   ` Lorenzo Stoakes (Oracle)
2026-04-01 21:03     ` Barry Song
2026-04-02 12:20       ` Lorenzo Stoakes (Oracle)
2026-04-02 21:49         ` Barry Song
2026-05-04  8:10           ` Lorenzo Stoakes
2026-05-02  6:53 ` Lorenzo Stoakes
2026-05-03 18:26   ` Rik van Riel [this message]
2026-05-04  8:01     ` Lorenzo Stoakes

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=8c729d621f281dd0b1a891f4aaccb0ba4956b219.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=baohua@kernel.org \
    --cc=chriscli@google.com \
    --cc=david@kernel.org \
    --cc=harry.yoo@oracle.com \
    --cc=jannh@google.com \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=pfalcato@suse.de \
    --cc=ryan.roberts@arm.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.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