Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-02 Thread Rik van Riel
On Sun, 2017-10-01 at 16:05 +0530, Gargi Sharma wrote: > On Sun, Oct 1, 2017 at 2:45 PM, Christoph Hellwig > wrote: > > > - task_active_pid_ns(current)->last_pid); > > > + task_active_pid_ns(current)->idr.idr_next-1); > > > > I think we want a well documented helper for th

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-02 Thread Rik van Riel
On Sun, 2017-10-01 at 02:15 -0700, Christoph Hellwig wrote: > > - task_active_pid_ns(current)->last_pid); > > + task_active_pid_ns(current)->idr.idr_next-1); > > I think we want a well documented helper for this pattern instead > of poking into the internals. > > Also is last

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-01 Thread Gargi Sharma
On Sun, Oct 1, 2017 at 2:45 PM, Christoph Hellwig wrote: >> - task_active_pid_ns(current)->last_pid); >> + task_active_pid_ns(current)->idr.idr_next-1); > > I think we want a well documented helper for this pattern instead > of poking into the internals. idr_get_cursor() ge

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-01 Thread Christoph Hellwig
> - task_active_pid_ns(current)->last_pid); > + task_active_pid_ns(current)->idr.idr_next-1); I think we want a well documented helper for this pattern instead of poking into the internals. Also is last - 1 always the correct answer? Even with idr_alloc_cyclic we could wr

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-27 Thread Oleg Nesterov
On 09/27, Gargi Sharma wrote: > > > > > And make this patch correct ;) > > > > because currently it is wrong, zap_pid_ns_processes() won't kill the pid > > returned by the first idr_get_next(). > Yes, I missed this. I can simply remove the idr_get_next() before the > idr_for_each_continue and that

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-27 Thread Gargi Sharma
On Wed, Sep 27, 2017 at 6:39 PM, Rik van Riel wrote: > On Wed, 2017-09-27 at 01:06 -0400, Gargi Sharma wrote: >> This patch replaces the current bitmap implemetation for >> Process ID allocation. Functions that are no longer required, >> for example, free_pidmap(), alloc_pidmap(), etc. are removed

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-27 Thread Oleg Nesterov
On 09/27, Gargi Sharma wrote: > > @@ -309,7 +168,22 @@ struct pid *alloc_pid(struct pid_namespace *ns) > tmp = ns; > pid->level = ns->level; > for (i = ns->level; i >= 0; i--) { > - nr = alloc_pidmap(tmp); > + int pid_min = 1; > + idr_preload(GF

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-27 Thread Gargi Sharma
On Wed, Sep 27, 2017 at 7:36 PM, Oleg Nesterov wrote: > On 09/27, Rik van Riel wrote: >> >> > @@ -240,17 +230,18 @@ void zap_pid_ns_processes(struct pid_namespace >> > *pid_ns) >> > * >> > */ >> > read_lock(&tasklist_lock); >> > - nr = next_pidmap(pid_ns, 1); >> > - while (nr > 0

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-27 Thread Oleg Nesterov
On 09/27, Rik van Riel wrote: > > > @@ -240,17 +230,18 @@ void zap_pid_ns_processes(struct pid_namespace > > *pid_ns) > >    * > >    */ > >   read_lock(&tasklist_lock); > > - nr = next_pidmap(pid_ns, 1); > > - while (nr > 0) { > > - rcu_read_lock(); > > + pid = idr_get_next(&

Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-27 Thread Rik van Riel
On Wed, 2017-09-27 at 01:06 -0400, Gargi Sharma wrote: > This patch replaces the current bitmap implemetation for > Process ID allocation. Functions that are no longer required, > for example, free_pidmap(), alloc_pidmap(), etc. are removed. > The rest of the functions are modified to use the IDR A

[PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API

2017-09-26 Thread Gargi Sharma
This patch replaces the current bitmap implemetation for Process ID allocation. Functions that are no longer required, for example, free_pidmap(), alloc_pidmap(), etc. are removed. The rest of the functions are modified to use the IDR API. The change was made to make the PID allocation less complex