[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260121135238.26578-1-boudewijn@delta-utec.com>
Date: Wed, 21 Jan 2026 14:52:38 +0100
From: Boudewijn van der Heide <boudewijn@...ta-utec.com>
To: liam.howlett@...cle.com
Cc: akpm@...ux-foundation.org,
aliceryhl@...gle.com,
andrewjballance@...il.com,
boudewijn@...ta-utec.com,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
maple-tree@...ts.infradead.org
Subject: Re: [PATCH v2] maple_tree: Add lockdep assertion in mas_dup_alloc()
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
Powered by blists - more mailing lists