Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Pedro Falcato <pfalcato@suse.de>, Andi Kleen <ak@kernel.org>,
	 akpm@linux-foundation.org, liam@infradead.org, jannh@google.com,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RCU safety for vma maple tree walks
Date: Mon, 31 Aug 2026 20:55:37 +0100	[thread overview]
Message-ID: <apXaTN6o5YaEO8FR@lucifer> (raw)
In-Reply-To: <apXXgimKxgJl57qo@firstfloor.org>

On Mon, Aug 31, 2026 at 12:35:30PM -0700, Andi Kleen wrote:
> > But none of this code uses RCU? I'm confused.
>
> There are two classes of callers: ones that change the maple tree while
> walking and those that don't. The ones that change it use
> kfree_rcu (if that's what you meant with "use RCU") because they can free
> nodes.
>
> The patch changes both classes, but strictly only the ones actually
> changing need the change. For the others the existing locking is
> indeed sufficient.

Andi I think you're really wildly off the mark here and it's not really a great
use of our time to help you debug your own private patch.

But in case you are on to a real bug here and I'm wildly wrong, it
shouldn't be difficult for you to point out precisely where the node is being
freed as a result of the split that causes a stale node to be referenced?

I mean what actually modifies the maple tree nodes here?

__split_vma()
  -> vma_complete()
    -> vma_iter_store_new()
      -> vma_iter_store_overwrite()

Right?

But I see:

	if (vmi->mas.status != ma_start &&
	    ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start)))
		vma_iter_invalidate(vmi);

Which calls mas_pause() which sets mas->node = NULL.

So I mean, presumably you are saying this doesn't work correctly or this
criteria is wrong, I can't really see how else there could be a problem here,
could you explain exactly what's up here?

Also why is the solution to insert a whole bunch of RCU read locks everywhere so
we can keep on accessing a node that we've already decided to free?

I mean surely the solution really ought to be simply invalidating the iterator
right?

Also again, could you share the patch you've applied to the kernel you're
actually seeing this bug in, given you haven't reproduced it even once with an
upstream kernel?

Thanks.

--
Cheers, Lorenzo


  reply	other threads:[~2026-08-31 19:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 14:35 [PATCH] RCU safety for vma maple tree walks Andi Kleen
2026-08-31 14:58 ` Pedro Falcato
2026-08-31 19:35   ` Andi Kleen
2026-08-31 19:55     ` Lorenzo Stoakes (ARM) [this message]
2026-09-01 21:05       ` Andi Kleen
2026-09-02 16:21         ` Lorenzo Stoakes (ARM)
2026-08-31 15:50 ` Lorenzo Stoakes (ARM)
2026-08-31 16:29 ` Liam R. Howlett
2026-08-31 16:52   ` Andi Kleen
2026-08-31 22:13     ` Liam R. Howlett

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=apXaTN6o5YaEO8FR@lucifer \
    --to=ljs@kernel.org \
    --cc=ak@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=jannh@google.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pfalcato@suse.de \
    /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