From: Brian Foster <bfoster@redhat.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ikent@redhat.com, onestero@redhat.com
Subject: [PATCH 1/3] radix-tree: propagate all tags in idr tree
Date: Tue, 14 Jun 2022 14:09:47 -0400 [thread overview]
Message-ID: <20220614180949.102914-2-bfoster@redhat.com> (raw)
In-Reply-To: <20220614180949.102914-1-bfoster@redhat.com>
The IDR tree has hardcoded tag propagation logic to handle the
internal IDR_FREE tag and ignore all others. Fix up the hardcoded
logic to support additional tags.
This is specifically to support a new internal IDR_TGID radix tree
tag used to improve search efficiency of pids with associated
PIDTYPE_TGID tasks within a pid namespace.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
lib/radix-tree.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index b3afafe46fff..08eef33e7820 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -431,12 +431,14 @@ static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp,
tag_clear(node, IDR_FREE, 0);
root_tag_set(root, IDR_FREE);
}
- } else {
- /* Propagate the aggregated tag info to the new child */
- for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
- if (root_tag_get(root, tag))
- tag_set(node, tag, 0);
- }
+ }
+
+ /* Propagate the aggregated tag info to the new child */
+ for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
+ if (is_idr(root) && tag == IDR_FREE)
+ continue;
+ if (root_tag_get(root, tag))
+ tag_set(node, tag, 0);
}
BUG_ON(shift > BITS_PER_LONG);
@@ -1368,11 +1370,13 @@ static bool __radix_tree_delete(struct radix_tree_root *root,
unsigned offset = get_slot_offset(node, slot);
int tag;
- if (is_idr(root))
- node_tag_set(root, node, IDR_FREE, offset);
- else
- for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++)
- node_tag_clear(root, node, tag, offset);
+ for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) {
+ if (is_idr(root) && tag == IDR_FREE) {
+ node_tag_set(root, node, tag, offset);
+ continue;
+ }
+ node_tag_clear(root, node, tag, offset);
+ }
replace_slot(slot, NULL, node, -1, values);
return node && delete_node(root, node);
--
2.34.1
next prev parent reply other threads:[~2022-06-14 18:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 18:09 [PATCH 0/3] proc: improve root readdir latency with many threads Brian Foster
2022-06-14 18:09 ` Brian Foster [this message]
2022-06-15 11:12 ` [PATCH 1/3] radix-tree: propagate all tags in idr tree Christoph Hellwig
2022-06-15 12:57 ` Brian Foster
2022-06-15 13:40 ` Matthew Wilcox
2022-06-15 14:43 ` Brian Foster
2022-06-15 16:34 ` Matthew Wilcox
2022-06-28 12:55 ` Christian Brauner
2022-06-28 14:53 ` Brian Foster
2022-06-29 19:13 ` Brian Foster
2022-07-11 20:24 ` Matthew Wilcox
2022-06-15 13:33 ` Ian Kent
2022-06-14 18:09 ` [PATCH 2/3] pid: use idr tag to hint pids associated with group leader tasks Brian Foster
2022-06-14 18:09 ` [PATCH 3/3] proc: use idr tgid tag hint to iterate pids in readdir Brian Foster
2022-06-15 13:44 ` Matthew Wilcox
2022-06-15 14:44 ` Brian Foster
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=20220614180949.102914-2-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=ikent@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=onestero@redhat.com \
/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