Re: [v6,1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-22 Thread Gargi Sharma
On Fri, Oct 20, 2017 at 6:21 PM, Andrei Vagin wrote: > On Fri, Oct 20, 2017 at 05:06:47PM +0100, Gargi Sharma wrote: >> On Thu, Oct 19, 2017 at 5:18 PM, Oleg Nesterov wrote: >> > On 10/19, Andrei Vagin wrote: >> >> >> >> Hi Gargi, >> >> >

Re: [v6,1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-20 Thread Gargi Sharma
On Thu, Oct 19, 2017 at 5:18 PM, Oleg Nesterov wrote: > On 10/19, Andrei Vagin wrote: >> >> Hi Gargi, >> >> This patch breaks CRIU, because it changes a meaning of ns_last_pid. > > ... > >> > @@ -311,7 +297,7 @@ static int pid_ns_ctl_handler(struct ctl_table *table, >> > int write, >> > * it

Re: [v6,1/2] pid: Replace pid bitmap implementation with IDR API

2017-10-19 Thread Gargi Sharma
t-20171018 #1 SMP Wed Oct 18 23:52:43 PDT 2017 > x86_64 x86_64 x86_64 GNU/Linux > $ echo 1 > /proc/sys/kernel/ns_last_pid && sh -c 'echo $$' > 1 > > Thanks, > Andrei > > On Wed, Oct 11, 2017 at 06:19:38PM -0400, Gargi Sharma wrote: >> T

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

2017-10-11 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/pid_namespace.h | 14 +-- init/main.c | 2

[PATCH v6 2/2] pid: Remove pidhash

2017-10-11 Thread Gargi Sharma
: Gargi Sharma --- arch/ia64/kernel/asm-offsets.c | 4 ++-- include/linux/init_task.h | 1 - include/linux/pid.h| 2 -- include/linux/pid_namespace.h | 4 ++-- init/main.c| 1 - kernel/fork.c | 2 +- kernel/pid.c | 48

[PATCH v6 0/2] Replacing PID bitmap implementation with IDR API

2017-10-11 Thread Gargi Sharma
Used idr_for_each_entry_continue() - Used idr_find() to lookup pids Gargi Sharma (2): pid: Replace pid bitmap implementation with IDR API pid: Remove pidhash arch/ia64/kernel/asm-offsets.c| 4 +- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/load

[PATCH v5 0/2] Replacing PID bitmap implementation with IDR API

2017-10-10 Thread Gargi Sharma
in v2: - Removed redundant IDR function that was introduced in the previous patchset. - Renamed PIDNS_HASH_ADDING - Used idr_for_each_entry_continue() - Used idr_find() to lookup pids Gargi Sharma (2): pid: Replace pid bitmap implementation with IDR API

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

2017-10-10 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/pid_namespace.h | 14 +-- init/main.c | 2

[PATCH v5 2/2] pid: Remove pidhash

2017-10-10 Thread Gargi Sharma
: Gargi Sharma --- include/linux/init_task.h | 1 - include/linux/pid.h | 2 -- include/linux/pid_namespace.h | 4 ++-- init/main.c | 1 - kernel/fork.c | 2 +- kernel/pid.c | 48 +-- kernel

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: >> > > >> > > > @@

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

[PATCH v4 2/2] pid: Remove pidhash

2017-10-09 Thread Gargi Sharma
: Gargi Sharma --- include/linux/init_task.h | 1 - include/linux/pid.h | 2 -- include/linux/pid_namespace.h | 4 ++-- init/main.c | 1 - kernel/fork.c | 2 +- kernel/pid.c | 48 +-- kernel

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

2017-10-09 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/pid_namespace.h | 14 +-- init/main.c | 2

[PATCH v4 0/2] Replacing PID bitmap implementation with IDR API

2017-10-09 Thread Gargi Sharma
chset. - Renamed PIDNS_HASH_ADDING - Used idr_for_each_entry_continue() - Used idr_find() to lookup pids Gargi Sharma (2): pid: Replace pid bitmap implementation with IDR API pid: Remove pidhash arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/load

[PATCH v3 2/2] pid: Remove pidhash

2017-10-06 Thread Gargi Sharma
: Gargi Sharma --- include/linux/init_task.h | 1 - include/linux/pid.h | 2 -- include/linux/pid_namespace.h | 4 ++-- init/main.c | 1 - kernel/fork.c | 2 +- kernel/pid.c | 48 +-- kernel

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

2017-10-06 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/pid_namespace.h | 14 +-- init/main.c | 2

[PATCH v3 0/2] Replace PID bitmap allocation with IDR API

2017-10-06 Thread Gargi Sharma
Used idr_for_each_entry_continue() - Used idr_find() to lookup pids Gargi Sharma (2): pid: Replace pid bitmap implementation with IDR API pid: Remove pidhash arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/init_t

Re: + pid-delete-struct-pidmap-nr_free.patch added to -mm tree

2017-10-03 Thread Gargi Sharma
On Tue, Oct 3, 2017 at 9:45 PM, Oleg Nesterov wrote: > On 10/02, Andrew Morton wrote: >> >> From: Alexey Dobriyan >> Subject: pid: delete struct pidmap::nr_free >> >> There is a check in pid allocation code to skip a full page: >> >> if (likely(atomic_read(&map->nr_free))) { >>

Re: [PATCH v2 2/2] pid: Remove pidhash

2017-10-02 Thread Gargi Sharma
On Mon, Oct 2, 2017 at 8:52 PM, Rik van Riel wrote: > On Mon, 2017-10-02 at 17:21 +0200, Oleg Nesterov wrote: >> Hi Rik, >> >> On 10/02, Rik van Riel wrote: >> > >> > Gargi and I are looking at that code, and trying to figure out >> > exactly what needs to be done to make all of this correct. >> >

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 2/2] pid: Remove pidhash

2017-09-30 Thread Gargi Sharma
> > And I just noticed you didn't cc Eric Biederman , > please do next time. Sorry for missing out on this. Will do with the next version. Thanks! Gargi > > > On 09/27, Oleg Nesterov wrote: >> >> On 09/27, Gargi Sharma wrote: >> > >> > -#defi

Re: [PATCH v2 0/2] Replace PID bitmap allocation with IDR API

2017-09-28 Thread Gargi Sharma
On Thu, Sep 28, 2017 at 3:46 PM, Rik van Riel wrote: > On Fri, 2017-09-29 at 01:09 +0530, Gargi Sharma wrote: > >> 1000 processes that just sleep and sit around without doing >> anything(100 second sleep and then exit). >> >> pstree with 10,000 processes >>

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(), all

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

[PATCH v2 2/2] pid: Remove pidhash

2017-09-26 Thread Gargi Sharma
: Gargi Sharma Reviewed-by: Rik van Riel --- include/linux/init_task.h | 1 - include/linux/pid.h | 2 -- include/linux/pid_namespace.h | 4 ++-- init/main.c | 1 - kernel/fork.c | 2 +- kernel/pid.c | 52

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

2017-09-26 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/pid_namespace.h | 14 +-- init/main.c | 2

[PATCH v2 0/2] Replace PID bitmap allocation with IDR API

2017-09-26 Thread Gargi Sharma
DDING - Used idr_for_each_entry_continue() - Used idr_find() to lookup pids Gargi Sharma (2): pid: Replace pid bitmap implementation with IDR API pid: Remove pidhash arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/

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

2017-09-25 Thread Gargi Sharma
On Mon, Sep 25, 2017 at 6:50 PM, Rik van Riel 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

Re: [PATCH 2/4] idr: Add a function idr_get()

2017-09-25 Thread Gargi Sharma
On Mon, Sep 25, 2017 at 7:42 PM, Oleg Nesterov wrote: > On 09/25, Gargi Sharma wrote: >> >> idr_get(namespace, id) returns a NULL if id is not present >> in the idr tree or returns the pointer to the struct if id is >> present in the idr tree. With this function in t

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

2017-09-25 Thread Gargi Sharma
On Mon, Sep 25, 2017 at 8:50 PM, Oleg Nesterov wrote: > On 09/25, Gargi Sharma wrote: >> >> @@ -285,10 +145,14 @@ void free_pid(struct pid *pid) >> break; >> } >> } >> - spin_unlock_irqrestore(&pidmap_loc

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

2017-09-25 Thread Gargi Sharma
On Mon, Sep 25, 2017 at 8:29 PM, Oleg Nesterov wrote: > On 09/25, Gargi Sharma wrote: >> >> void zap_pid_ns_processes(struct pid_namespace *pid_ns) >> { >> - int nr; >> + int nr = 2; >> int rc; >> struct task_struct

[PATCH 2/4] idr: Add a function idr_get()

2017-09-25 Thread Gargi Sharma
. Signed-off-by: Gargi Sharma --- include/linux/idr.h | 1 + lib/idr.c | 11 +++ 2 files changed, 12 insertions(+) diff --git a/include/linux/idr.h b/include/linux/idr.h index 7c3a365..e12b174 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -135,6 +135,7 @@ int

[PATCH 4/4] pid: Remove pidhash

2017-09-25 Thread Gargi Sharma
pidhash is no longer required as all the information can be looked up from idr tree. Also, nr_hashed represented the number of pids that had been hashed. Since, nr_hashed is no longer relevant, it has been renamed to pid_allocated. Signed-off-by: Gargi Sharma --- include/linux/init_task.h

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

2017-09-25 Thread Gargi Sharma
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 --- kernel/pid.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a

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

2017-09-25 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/loadavg.c | 2 +- include/linux/pid_namespace.h | 14 +-- init/main.c | 2

[PATCH 0/4] Replace PID bitmap with IDR API implementation

2017-09-25 Thread Gargi Sharma
d for allocation of PIDs to the processes. The IDR implementation is a little faster than bitmap implementation. Gargi Sharma (4): pid: Replace pid bitmap implementation with IDR API idr: Add a function idr_get() pid.c: Replace pidhash lookup with idr_get() pid: Remove pidhash arch/po

[RFC 2/2] pid: Replace PID bitmap implementation with IDR API

2017-09-09 Thread Gargi Sharma
complex by replacing custom code with calls to generic API. Signed-off-by: Gargi Sharma --- include/linux/pid.h | 1 + include/linux/pid_namespace.h | 5 +- init/main.c | 4 +- kernel/pid.c | 204 -- kernel

[RFC 0/2] Replace PID implementation with IDR API

2017-09-09 Thread Gargi Sharma
d for allocation of PIDs to the processes. The IDR implementation is a little faster than bitmap implementation. The next change in the pipeline is replacing pidhash with IDR API implementation. Gargi Sharma (2): proc: Return if nothing to unmount pid: Replace PID bitmap implementation with ID

[RFC 1/2] proc: Return if nothing to unmount

2017-09-09 Thread Gargi Sharma
If a task exits before procfs is mounted, proc_flush_task_mnt will be called with a NULL mnt parameter. In that case, not only is there nothing to unhash, but trying to do so will oops the kernel with a null pointer dereference. Signed-off-by: Gargi Sharma --- fs/proc/base.c | 4 1 file

Re: [Outreachy kernel] Re: [PATCH] staging: iio: ade7753: replace mlock with driver private lock

2017-03-19 Thread Gargi Sharma
On Mon, Mar 13, 2017 at 5:30 PM, Lars-Peter Clausen wrote: > On 03/12/2017 02:32 PM, simran singhal wrote: >> The IIO subsystem is redefining iio_dev->mlock to be used by >> the IIO core only for protecting device operating mode changes. >> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* mod

Re: [Outreachy kernel] [PATCH v5] staging: Use buf_lock instead of mlock and Refactor code

2017-03-19 Thread Gargi Sharma
On Sun, Mar 19, 2017 at 6:20 PM, simran singhal wrote: > The IIO subsystem is redefining iio_dev->mlock to be used by > the IIO core only for protecting device operating mode changes. > ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. > > In this driver, mlock was being used to protect

Re: [Outreachy kernel] Re: [PATCH] staging: iio: ade7753: replace mlock with driver private lock

2017-03-19 Thread Gargi Sharma
On Sun, Mar 19, 2017 at 4:01 PM, Jonathan Cameron wrote: > On 17/03/17 09:32, Gargi Sharma wrote: >> On Mon, Mar 13, 2017 at 5:30 PM, Lars-Peter Clausen wrote: >>> >>> On 03/12/2017 02:32 PM, simran singhal wrote: >>>> The IIO subsystem is redefining ii

Re: [Outreachy kernel] Re: [PATCH] staging: iio: ade7753: replace mlock with driver private lock

2017-03-17 Thread Gargi Sharma
On Mon, Mar 13, 2017 at 5:30 PM, Lars-Peter Clausen wrote: > > On 03/12/2017 02:32 PM, simran singhal wrote: > > The IIO subsystem is redefining iio_dev->mlock to be used by > > the IIO core only for protecting device operating mode changes. > > ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_