From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753908AbdIYOND (ORCPT ); Mon, 25 Sep 2017 10:13:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57348 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbdIYONC (ORCPT ); Mon, 25 Sep 2017 10:13:02 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 886B8C074F11 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Date: Mon, 25 Sep 2017 16:12:58 +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 2/4] idr: Add a function idr_get() Message-ID: <20170925141258.GA9328@redhat.com> References: <6d2d9a99d9047a38ae3b8442e537e76c54511c51.1506342921.git.gs051095@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d2d9a99d9047a38ae3b8442e537e76c54511c51.1506342921.git.gs051095@gmail.com> 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.31]); Mon, 25 Sep 2017 14:13:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 the idr library, > code for pid allocation can be simplified by calling this function > instead of looking through the pidhash. Could you explain why find_pid_ns() can't use idr_find() ? > +void * idr_get(struct idr *idr, int *id) > +{ > + struct radix_tree_node *node; > + void __rcu **slot = NULL; > + > + __radix_tree_lookup(&idr->idr_rt, *id, &node, &slot); so why it takes "int *", not just "int" ? Oleg.