Re: [PATCH 3/4] pid.c: Replace pidhash lookup with idr_get()

From: Rik van Riel
Date: Mon Sep 25 2017 - 15:41:28 EST


On Mon, 2017-09-25 at 23:14 +0530, Gargi Sharma wrote:
> On Mon, Sep 25, 2017 at 6:50 PM, Rik van Riel <riel@xxxxxxxxxxx>
> wrote:
> > On Mon, 2017-09-25 at 08:56 -0400, Gargi Sharma wrote:
> > > pidhash is no longer required as all the functionalities
> > > are present in the idr tree associated with the namespace.
> > > nr can be looked up in the namespace by idr_get().
> > >
> > > Signed-off-by: Gargi Sharma <gs051095@xxxxxxxxx>
> > > ---
> > > Âkernel/pid.c | 10 +---------
> > > Â1 file changed, 1 insertion(+), 9 deletions(-)
> > >
> > > diff --git a/kernel/pid.c b/kernel/pid.c
> > > index ea22e89..761a0c2 100644
> > > --- a/kernel/pid.c
> > > +++ b/kernel/pid.c
> > > @@ -247,15 +247,7 @@ void disable_pid_allocation(struct
> > > pid_namespace
> > > *ns)
> > >
> > > Âstruct pid *find_pid_ns(int nr, struct pid_namespace *ns)
> > > Â{
> > > -ÂÂÂÂÂstruct upid *pnr;
> > > -
> > > -ÂÂÂÂÂhlist_for_each_entry_rcu(pnr,
> > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ&pid_hash[pid_hashfn(nr, ns)], pid_chain)
> > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂif (pnr->nr == nr && pnr->ns == ns)
> > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn container_of(pnr, struct pid,
> > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂnumbers[ns->level]);
> > > -
> > > -ÂÂÂÂÂreturn NULL;
> > > +ÂÂÂÂÂreturn idr_get(&ns->idr, &nr);
> > > Â}
> > > ÂEXPORT_SYMBOL_GPL(find_pid_ns);
> >
> > Does this work if you call idr_find instead of idr_get?
> >
> > Then patch 2/4 would not be needed.
>
> Yes, patch 2/4 can be dropped. I think this patch can be merged with
> patch 4/4 where I remove pidhash, since this function is more or less
> aimed at that too?

Yes, that would simplify your patch series a little bit.

--
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part