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

From: Oleg Nesterov
Date: Wed Sep 27 2017 - 11:17:18 EST


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 will take care of it.

Yes, and also remove the while(pid) loop as Rik suggests, just do

read_lock(&tasklist_lock);
nr = 2;
idr_for_each_entry_continue(..., nr) {
kill pid_task()
}
read_unlock(&tasklist_lock);

Oleg.