From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
"Paul E . McKenney" <paulmck@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Matthew Wilcox <willy@infradead.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>
Subject: [PATCH 0/6] maple_tree: Change replacement strategy
Date: Fri, 4 Aug 2023 12:59:45 -0400 [thread overview]
Message-ID: <20230804165951.2661157-1-Liam.Howlett@oracle.com> (raw)
The maple tree marks nodes dead as soon as they are going to be
replaced. This could be problematic when used in the RCU context since
the writer may be starved of CPU time by the readers. This patch set
addresses the issue by switching the data replacement strategy to one
that will only mark data as dead once the new data is available.
This series changes the ordering of the node replacement so that the new
data is live before the old data is marked 'dead'. When readers hit
'dead' nodes, they will restart from the top of the tree and end up in
the new data.
In more complex scenarios, the replacement strategy means a subtree is
built and graphed into the tree leaving some nodes to point to the old
parent. The view of tasks into the old data will either remain with the
old data, or see the new data once the old data is marked 'dead'.
Iterators will see the 'dead' node and restart on their own and switch
to the new data. There is no risk of the reader seeing old data in
these cases.
The 'dead' subtree of data is then fully marked dead, but reused nodes
will still point to the dead nodes until the parent pointer is updated.
Walking up to a 'dead' node will cause a re-walk from the top of the
tree and enter the new data area where old data is not reachable.
Once the parent pointers are fully up to date in the active data, the
'dead' subtree is iterated to collect entirely 'dead' subtrees, and dead
nodes (nodes that partially contained reused data).
Liam R. Howlett (6):
maple_tree: Add hex output to maple_arange64 dump
maple_tree: Reorder replacement of nodes to avoid live lock
maple_tree: introduce mas_put_in_tree()
maple_tree: Introduce mas_tree_parent() definition
maple_tree: Change mas_adopt_children() parent usage
maple_tree: Replace data before marking dead in split and spanning
store
lib/maple_tree.c | 607 +++++++++++++++++++----------------------------
1 file changed, 240 insertions(+), 367 deletions(-)
--
2.39.2
next reply other threads:[~2023-08-04 17:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 16:59 Liam R. Howlett [this message]
2023-08-04 16:59 ` [PATCH 1/6] maple_tree: Add hex output to maple_arange64 dump Liam R. Howlett
2023-08-04 16:59 ` [PATCH 2/6] maple_tree: Reorder replacement of nodes to avoid live lock Liam R. Howlett
2023-08-04 16:59 ` [PATCH 3/6] maple_tree: introduce mas_put_in_tree() Liam R. Howlett
2023-08-04 16:59 ` [PATCH 4/6] maple_tree: Introduce mas_tree_parent() definition Liam R. Howlett
2023-08-04 16:59 ` [PATCH 5/6] maple_tree: Change mas_adopt_children() parent usage Liam R. Howlett
2023-08-04 16:59 ` [PATCH 6/6] maple_tree: Replace data before marking dead in split and spanning store Liam R. Howlett
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=20230804165951.2661157-1-Liam.Howlett@oracle.com \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=paulmck@kernel.org \
--cc=surenb@google.com \
--cc=willy@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