Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936144AbdIYPUb (ORCPT ); Mon, 25 Sep 2017 11:20:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34176 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932107AbdIYPUa (ORCPT ); Mon, 25 Sep 2017 11:20:30 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CE5E9267C5 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Date: Mon, 25 Sep 2017 17:20:27 +0200 From: Oleg Nesterov To: Gargi Sharma Cc: linux-kernel@vger.kernel.org, riel@surriel.com, julia.lawall@lip6.fr, akpm@linux-foundation.org, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com Subject: Re: [PATCH 1/4] pid: Replace pid bitmap implementation with IDR API Message-ID: <20170925152027.GA12957@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 25 Sep 2017 15:20:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 680 Lines: 27 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 ? Oleg.