From: Brian Foster <bfoster@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
ikent@redhat.com, onestero@redhat.com
Subject: Re: [PATCH 3/3] proc: use idr tgid tag hint to iterate pids in readdir
Date: Wed, 15 Jun 2022 10:44:31 -0400 [thread overview]
Message-ID: <YqnwT2SafZcVaFNO@bfoster> (raw)
In-Reply-To: <YqniOxl4ACKVp9hM@casper.infradead.org>
On Wed, Jun 15, 2022 at 02:44:27PM +0100, Matthew Wilcox wrote:
> On Tue, Jun 14, 2022 at 02:09:49PM -0400, Brian Foster wrote:
> > +++ b/include/linux/idr.h
> > @@ -185,6 +185,20 @@ static inline bool idr_is_group_lead(struct idr *idr, unsigned long id)
> > return radix_tree_tag_get(&idr->idr_rt, id, IDR_TGID);
> > }
> >
> > +/*
> > + * Find the next id with a potentially associated TGID task using the internal
> > + * tag. Task association is not guaranteed and must be checked explicitly.
> > + */
> > +static inline struct pid *find_tgid_pid(struct idr *idr, unsigned long id)
> > +{
> > + struct pid *pid;
> > +
> > + if (radix_tree_gang_lookup_tag(&idr->idr_rt, (void **) &pid, id, 1,
> > + IDR_TGID) != 1)
> > + return NULL;
> > + return pid;
> > +}
>
> The IDR is a generic data structure, and shouldn't know anything about
> PIDs, TGIDs or tasks.
>
Hm, Ok. So I suppose this interface should probably be split up a bit
more. The idr wrappers can be more generic along the lines of
idr_set_tag(), idr_is_tagged(), idr_get_next_tagged(), etc. This would
use something like an IDR_TAG1 internally (instead of IDR_TGID) to
basically expose support for a single, generic, idr-iternal (but
external radix-tree) tag for idr consumers. (Presumably this would map
directly over to xarray marks per your reply to patch 1). Then, the
find_tgid_pid() bits can be lifted into the pid code along the lines of
find_ge_pid() (along with perhaps some other simple "tgid" wrappers over
the idr tag mechanism).
If that sounds generally reasonable, I'll wait for any feedback on the
functional approach and follow up with something like that in v2..
Brian
prev parent reply other threads:[~2022-06-15 14:44 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 ` [PATCH 1/3] radix-tree: propagate all tags in idr tree Brian Foster
2022-06-15 11:12 ` 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 [this message]
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=YqnwT2SafZcVaFNO@bfoster \
--to=bfoster@redhat.com \
--cc=ikent@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=onestero@redhat.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;
as well as URLs for NNTP newsgroup(s).