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

From: Gargi Sharma
Date: Mon Sep 25 2017 - 13:42:24 EST


On Mon, Sep 25, 2017 at 8:50 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> On 09/25, Gargi Sharma wrote:
>>
>> @@ -285,10 +145,14 @@ void free_pid(struct pid *pid)
>> break;
>> }
>> }
>> - spin_unlock_irqrestore(&pidmap_lock, flags);
>>
>> - for (i = 0; i <= pid->level; i++)
>> - free_pidmap(pid->numbers + i);
>> + for (i = 0; i <= pid->level; i++) {
>> + struct upid *upid = pid->numbers + i;
>> + struct pid_namespace *ns = upid->ns;
>> +
>> + idr_remove(&ns->idr, upid->nr);
>> + }
>> + spin_unlock_irqrestore(&pidmap_lock, flags);
>
> Now that you moved the "free pidmap" code under pidmap_lock, we do not
> need 2 "for (i = 0; i <= pid->level; i++)" loops, you could simply add
> a single
>
> idr_remove(&ns->idr, upid->nr);
>
> line into the 1st loop ?

Yes, I can do that. Will make this change.

Thanks!
Gargi
>
> Oleg.
>