From: Matthew Wilcox <willy@infradead.org>
To: Mark Brown <broonie@kernel.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] maple_tree: Allow external locks to be configured with their map
Date: Thu, 22 Aug 2024 20:21:40 +0100 [thread overview]
Message-ID: <ZsePxD2FtYcBIaD5@casper.infradead.org> (raw)
In-Reply-To: <20240822-b4-regmap-maple-nolock-v1-1-d5e6dbae3396@kernel.org>
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@kernel.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@lists.infradead.org
> https://lists.infradead.org/mailman/listinfo/maple-tree
next prev parent reply other threads:[~2024-08-22 19:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 19:13 [PATCH 0/5] regmap: Improve lock handling with maple tree Mark Brown
2024-08-22 19:13 ` [PATCH 1/5] maple_tree: Allow external locks to be configured with their map Mark Brown
2024-08-22 19:21 ` Matthew Wilcox [this message]
2024-08-22 19:48 ` Mark Brown
2024-08-22 19:55 ` Matthew Wilcox
2024-08-22 20:45 ` Mark Brown
2024-08-22 19:13 ` [PATCH 2/5] regmap: Hold the regmap lock when allocating and freeing the cache Mark Brown
[not found] ` <CGME20240828100239eucas1p2afc0d3088c66468061baf81c5676882a@eucas1p2.samsung.com>
2024-08-28 10:02 ` Marek Szyprowski
2024-08-28 11:32 ` Mark Brown
2024-08-22 19:13 ` [PATCH 3/5] regmap: Use locking during kunit tests Mark Brown
2024-08-22 19:13 ` [PATCH 4/5] regmap: Wrap maple tree locking Mark Brown
2024-08-22 19:13 ` [PATCH 5/5] regmap: Don't double lock maple cache when using a regmap provided lock Mark Brown
2024-08-23 22:57 ` (subset) [PATCH 0/5] regmap: Improve lock handling with maple tree Mark Brown
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=ZsePxD2FtYcBIaD5@casper.infradead.org \
--to=willy@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=broonie@kernel.org \
--cc=cristian.ciocaltea@collabora.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