[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsePxD2FtYcBIaD5@casper.infradead.org>
Date: Thu, 22 Aug 2024 20:21:40 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Mark Brown <broonie@...nel.org>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Cristian Ciocaltea <cristian.ciocaltea@...labora.com>,
maple-tree@...ts.infradead.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] maple_tree: Allow external locks to be configured
with their map
On Thu, Aug 22, 2024 at 08:13:35PM +0100, Mark Brown wrote:
> Currently the maple tree code allows external locks to be configured by
> passing the lock itself. This is generally helpful and convenient but is
No, it's a really bad idea. Stop doing it. Use the internal lock.
It's a temporary hack we put in and I'm really regretting allowing it.
> not ideal for situations like the regmap maple tree cache where we support
> configurable locking at the regmap level and don't have the lock type when
> we are configuring the maple tree. Add a helper that allows us to pass the
> dep map directly to help with these situations. Since such code is already
> peering at the lockdep internals enough to be looking at the map no stub
> is provided.
>
> Signed-off-by: Mark Brown <broonie@...nel.org>
> ---
> include/linux/maple_tree.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
> index a53ad4dabd7e..bdc6b133abdc 100644
> --- a/include/linux/maple_tree.h
> +++ b/include/linux/maple_tree.h
> @@ -193,6 +193,9 @@ typedef struct lockdep_map *lockdep_map_p;
> #define mt_set_external_lock(mt, lock) \
> (mt)->ma_external_lock = &(lock)->dep_map
>
> +#define mt_set_external_lock_dep_map(mt, dep_map) \
> + (mt)->ma_external_lock = dep_map
> +
> #define mt_on_stack(mt) (mt).ma_external_lock = NULL
> #else
> typedef struct { /* nothing */ } lockdep_map_p;
>
> --
> 2.39.2
>
>
> --
> maple-tree mailing list
> maple-tree@...ts.infradead.org
> https://lists.infradead.org/mailman/listinfo/maple-tree
Powered by blists - more mailing lists