Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965346AbdIYRpT (ORCPT ); Mon, 25 Sep 2017 13:45:19 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:36648 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965332AbdIYRpR (ORCPT ); Mon, 25 Sep 2017 13:45:17 -0400 X-Google-Smtp-Source: AOwi7QAbfhlygKb4FpqzSXpVuAhL5AcSJDCnTYTGlyjOONgdXEqK60czemR9J33yZQBUjDoDj3mc9F2BGxqfgdNu+Ks= MIME-Version: 1.0 In-Reply-To: <1506345653.21121.82.camel@surriel.com> References: <1506345653.21121.82.camel@surriel.com> From: Gargi Sharma Date: Mon, 25 Sep 2017 23:14:45 +0530 Message-ID: Subject: Re: [PATCH 3/4] pid.c: Replace pidhash lookup with idr_get() To: Rik van Riel Cc: linux-kernel@vger.kernel.org, Julia Lawall , akpm@linux-foundation.org, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, Oleg Nesterov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1454 Lines: 45 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 namespace by idr_get(). >> >> Signed-off-by: Gargi Sharma >> --- >> kernel/pid.c | 10 +--------- >> 1 file changed, 1 insertion(+), 9 deletions(-) >> >> diff --git a/kernel/pid.c b/kernel/pid.c >> index ea22e89..761a0c2 100644 >> --- a/kernel/pid.c >> +++ b/kernel/pid.c >> @@ -247,15 +247,7 @@ void disable_pid_allocation(struct pid_namespace >> *ns) >> >> struct pid *find_pid_ns(int nr, struct pid_namespace *ns) >> { >> - struct upid *pnr; >> - >> - hlist_for_each_entry_rcu(pnr, >> - &pid_hash[pid_hashfn(nr, ns)], pid_chain) >> - if (pnr->nr == nr && pnr->ns == ns) >> - return container_of(pnr, struct pid, >> - numbers[ns->level]); >> - >> - return NULL; >> + return idr_get(&ns->idr, &nr); >> } >> EXPORT_SYMBOL_GPL(find_pid_ns); > > Does this work if you call idr_find instead of idr_get? > > Then patch 2/4 would not be needed. Yes, patch 2/4 can be dropped. I think this patch can be merged with patch 4/4 where I remove pidhash, since this function is more or less aimed at that too? Thanks! Gargi > > -- > All Rights Reversed.