linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Boudewijn van der Heide <boudewijn@delta-utec.com>
To: liam.howlett@oracle.com
Cc: akpm@linux-foundation.org, aliceryhl@google.com,
	andrewjballance@gmail.com, boudewijn@delta-utec.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	maple-tree@lists.infradead.org
Subject: Re: [PATCH v2] maple_tree: Add lockdep assertion in mas_dup_alloc()
Date: Wed, 21 Jan 2026 14:52:38 +0100	[thread overview]
Message-ID: <20260121135238.26578-1-boudewijn@delta-utec.com> (raw)
In-Reply-To: <h54uysfjc62hxcxdnhpj4fnc3smufwiocdkzp3uiah3e2323hc@ljfkxmstxnbo>

Thanks for the review! That makes sense, I overlooked this detail in v2.
We should absolutely just check in __mt_dup(),
like mtree_dup() does for actual locks.
I took a closer look at __mt_dup() and mtree_dup(),
and I saw that mtree_dup() locks both the new and old maple_tree.
So I think it also makes sense for us to assert both trees in __mt_dup(),
like this:

@@ -6379,6 +6379,9 @@ int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp)
 	MA_STATE(mas, mt, 0, 0);
 	MA_STATE(new_mas, new, 0, 0);
 
+	lockdep_assert(mt_write_locked(new));
+	lockdep_assert(mt_write_locked(mt));
+
 	mas_dup_build(&mas, &new_mas, gfp);
 	if (unlikely(mas_is_err(&mas))) {
 		ret = xa_err(mas.node);

Does that look good to you for v3?

> >  	/* Allocate memory for child nodes. */
> >  	type = mte_node_type(mas->node);
> >  	new_slots = ma_slots(new_node, type);
> > --
> > 2.47.3
> > 
> >
> 

Thanks,
Boudewijn


      reply	other threads:[~2026-01-21 13:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-03 16:57 [PATCH] maple_tree: Add dead node check " Boudewijn van der Heide
2026-01-03 18:32 ` Andrew Morton
2026-01-03 20:06   ` Boudewijn van der Heide
2026-01-06  1:33     ` Andrew Morton
2026-01-06  2:49       ` Matthew Wilcox
2026-01-06  3:40         ` Andrew Morton
2026-01-06 13:24         ` Boudewijn van der Heide
2026-01-06 16:01           ` Liam R. Howlett
2026-01-06 16:48             ` Boudewijn van der Heide
2026-01-06 18:29             ` Matthew Wilcox
2026-01-06 20:07               ` Liam R. Howlett
2026-01-06 21:07 ` [PATCH v2] maple_tree: Add lockdep assertion " Boudewijn van der Heide
2026-01-20 18:42   ` Liam R. Howlett
2026-01-21 13:52     ` Boudewijn van der Heide [this message]

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=20260121135238.26578-1-boudewijn@delta-utec.com \
    --to=boudewijn@delta-utec.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=andrewjballance@gmail.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.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