Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739015 > unrolled thread
| Started by | Gargi Sharma <gs051095@gmail.com> |
|---|---|
| First post | 2017-09-25 15:00 +0200 |
| Last post | 2017-09-25 21:50 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/4] pid.c: Replace pidhash lookup with idr_get() Gargi Sharma <gs051095@gmail.com> - 2017-09-25 15:00 +0200
Re: [PATCH 3/4] pid.c: Replace pidhash lookup with idr_get() Rik van Riel <riel@surriel.com> - 2017-09-25 15:30 +0200
Re: [PATCH 3/4] pid.c: Replace pidhash lookup with idr_get() Gargi Sharma <gs051095@gmail.com> - 2017-09-25 19:50 +0200
Re: [PATCH 3/4] pid.c: Replace pidhash lookup with idr_get() Rik van Riel <riel@surriel.com> - 2017-09-25 21:50 +0200
| From | Gargi Sharma <gs051095@gmail.com> |
|---|---|
| Date | 2017-09-25 15:00 +0200 |
| Subject | [PATCH 3/4] pid.c: Replace pidhash lookup with idr_get() |
| Message-ID | <utB9n-6tv-7@gated-at.bofh.it> |
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@gmail.com>
---
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);
--
2.7.4
[toc] | [next] | [standalone]
| From | Rik van Riel <riel@surriel.com> |
|---|---|
| Date | 2017-09-25 15:30 +0200 |
| Message-ID | <utBCq-6Vt-13@gated-at.bofh.it> |
| In reply to | #1739015 |
[Multipart message — attachments visible in raw view] — view raw
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@gmail.com>
> ---
> 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.
--
All Rights Reversed.
[toc] | [prev] | [next] | [standalone]
| From | Gargi Sharma <gs051095@gmail.com> |
|---|---|
| Date | 2017-09-25 19:50 +0200 |
| Message-ID | <utFG1-198-1@gated-at.bofh.it> |
| In reply to | #1739053 |
On Mon, Sep 25, 2017 at 6:50 PM, Rik van Riel <riel@surriel.com> 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@gmail.com>
>> ---
>> 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?
Thanks!
Gargi
>
> --
> All Rights Reversed.
[toc] | [prev] | [next] | [standalone]
| From | Rik van Riel <riel@surriel.com> |
|---|---|
| Date | 2017-09-25 21:50 +0200 |
| Message-ID | <utHya-2oD-19@gated-at.bofh.it> |
| In reply to | #1739192 |
[Multipart message — attachments visible in raw view] — view raw
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@surriel.com>
> 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@gmail.com>
> > > ---
> > > 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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web