lkml.org 
[lkml]   [2022]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/3] proc: use idr tgid tag hint to iterate pids in readdir
    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.

    \
     
     \ /
      Last update: 2022-06-15 15:44    [W:2.818 / U:0.296 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site