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

2017-10-10 Thread Rik van Riel
On Tue, 2017-10-10 at 17:11 +0100, Gargi Sharma wrote: > > I have listed down the code for both idr_for_each and > idr_for_each_entry. > IMHO idr_for_each_entry is easier to read, but YMMV. :) > > void kill_task(int id, void *ptr, void *data) > { > struct *pid = ptr; > struct task_struct

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

2017-10-10 Thread Gargi Sharma
On Tue, Oct 10, 2017 at 4:46 PM, Rik van Riel wrote: > On Tue, 2017-10-10 at 13:35 +0100, Gargi Sharma wrote: >> On Tue, Oct 10, 2017 at 12:50 PM, Oleg Nesterov >> wrote: >> > On 10/09, Andrew Morton wrote: >> > > >> > > > @@ -240,17 +230,11 @@ void zap_pid_ns_processes(struct >> > > > pid_namesp

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

2017-10-10 Thread Rik van Riel
On Tue, 2017-10-10 at 13:35 +0100, Gargi Sharma wrote: > On Tue, Oct 10, 2017 at 12:50 PM, Oleg Nesterov > wrote: > > On 10/09, Andrew Morton wrote: > > > > > > > @@ -240,17 +230,11 @@ void zap_pid_ns_processes(struct > > > > pid_namespace *pid_ns) > > > >  * > > > >  */ > > > > read_

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

2017-10-10 Thread Oleg Nesterov
On 10/10, Gargi Sharma wrote: > > On Tue, Oct 10, 2017 at 12:50 PM, Oleg Nesterov wrote: > > On 10/09, Andrew Morton wrote: > >> > >> Especially here. I don't think pidmap_lock is held. Is that IDR > >> iteration safe? > > > > Yes, this doesn't look right, we need rcu_read_lock() or pidmap_lock.

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

2017-10-10 Thread Rik van Riel
On Tue, 2017-10-10 at 13:50 +0200, Oleg Nesterov wrote: > On 10/09, Andrew Morton wrote: > > > > > @@ -240,17 +230,11 @@ void zap_pid_ns_processes(struct > > > pid_namespace *pid_ns) > > >    * > > >    */ > > >   read_lock(&tasklist_lock); > > > - nr = next_pidmap(pid_ns, 1); > > > - while (nr >

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

2017-10-10 Thread Gargi Sharma
On Tue, Oct 10, 2017 at 12:50 PM, Oleg Nesterov wrote: > On 10/09, Andrew Morton wrote: >> >> > @@ -240,17 +230,11 @@ void zap_pid_ns_processes(struct pid_namespace >> > *pid_ns) >> > * >> > */ >> > read_lock(&tasklist_lock); >> > - nr = next_pidmap(pid_ns, 1); >> > - while (nr

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

2017-10-10 Thread Oleg Nesterov
On 10/09, Andrew Morton wrote: > > > @@ -240,17 +230,11 @@ 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(); > > - > > - task

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

2017-10-09 Thread Andrew Morton
On Mon, 9 Oct 2017 17:13:43 -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

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

2017-10-09 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