linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: linux-mm@kvack.org, Mark Brown <broonie@kernel.org>
Subject: [PATCH 0/2] regmap: Add basic maple tree register cache
Date: Sat, 25 Mar 2023 21:52:57 +0000	[thread overview]
Message-ID: <20230325-regcache-maple-v1-0-1c76916359fb@kernel.org> (raw)

The current state of the art for sparse register maps is the rbtree cache.
This works well for most applications but isn't always ideal for sparser
register maps since the rbtree can get deep, requiring a lot of walking.
Fortunately the kernel has a data structure intended to address this very
problem, the maple tree. Provide an initial implementation of a register
cache based on the maple tree to start taking advantage of it.

This initial implementation is very simplistic and doesn't take full
advantage of the capabilities of the maple tree, we simply store each
register as a single value within the tree. Since maple tree values are
pointers and iteration doesn't naturally give us the key we allocate a
small structure for each register, effectively adding another layer to the
tree.

We also store data in host native format rather than device native format
as we do for rbtree, this will be a benefit for devices where we don't
marshal data within regmap and until we are able to store more than one
register in a node there's no reason to have preformatted data even where
we do marshal.

This works well enough to get started and should already work well for some
devices but there is a great deal of room for improvement, as well as
storing blocks rather than just individual registers we don't need the
locking that the maple tree does and are likely to benefit from caching the
last accessed entry. Very small register maps may continue to to better
with rbtree longer term.

This series depends on a number of patches sent previously and separately, 
including KUnit support and some core fixes and features.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (2):
      regmap: Factor out single value register syncing
      regmap: Add maple tree based register cache

 drivers/base/regmap/Makefile         |   2 +-
 drivers/base/regmap/internal.h       |   2 +
 drivers/base/regmap/regcache-maple.c | 154 +++++++++++++++++++++++++++++++++++
 drivers/base/regmap/regcache.c       |  41 ++++++----
 drivers/base/regmap/regmap-kunit.c   |   3 +
 include/linux/regmap.h               |   1 +
 6 files changed, 188 insertions(+), 15 deletions(-)
---
base-commit: c20bc1c03695287bd19922a32052f2bc7d4a462d
change-id: 20230325-regcache-maple-364e7581cf0c

Best regards,
-- 
Mark Brown <broonie@kernel.org>



             reply	other threads:[~2023-03-25 21:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 21:52 Mark Brown [this message]
2023-03-25 21:52 ` [PATCH 1/2] regmap: Factor out single value register syncing Mark Brown
2023-03-25 21:52 ` [PATCH 2/2] regmap: Add maple tree based register cache Mark Brown
2023-03-25 23:41   ` Liam R. Howlett
2023-03-26  1:21     ` Mark Brown
2023-04-07 18:14 ` [PATCH 0/2] regmap: Add basic 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=20230325-regcache-maple-v1-0-1c76916359fb@kernel.org \
    --to=broonie@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=linux-mm@kvack.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