From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758444AbdJMO7A (ORCPT ); Fri, 13 Oct 2017 10:59:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50198 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754188AbdJMO67 (ORCPT ); Fri, 13 Oct 2017 10:58:59 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D96D3C0587C4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Date: Fri, 13 Oct 2017 16:58:55 +0200 From: Oleg Nesterov To: Andrew Morton Cc: Rik van Riel , Gargi Sharma , linux-kernel@vger.kernel.org, julia.lawall@lip6.fr, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, ebiederm@xmission.com, hch@infradead.org, lkp@intel.com, tony.luck@intel.com Subject: Re: [PATCH v6 1/2] pid: Replace pid bitmap implementation with IDR API Message-ID: <20171013145855.GB23154@redhat.com> References: <1507760379-21662-1-git-send-email-gs051095@gmail.com> <1507760379-21662-2-git-send-email-gs051095@gmail.com> <20171011153716.5cd0689bb7030b886b0d62f9@linux-foundation.org> <1507769672.21121.192.camel@surriel.com> <20171012155850.1f38f3a6fd14c669343d4492@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171012155850.1f38f3a6fd14c669343d4492@linux-foundation.org> 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.32]); Fri, 13 Oct 2017 14:58:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/12, Andrew Morton wrote: > > On Wed, 11 Oct 2017 20:54:32 -0400 Rik van Riel wrote: > > > Documenting the locking on all the existing code, plus the > > new code, seems a little out of scope of an Outreachy > > internship... > > I'm not referring to all the existing code! Just this new > pid_namespace.idr's locking. If it was protected by > spin_lock_irq(&pidmap_lock) everywhere then an explanation wouldn't be > needed. But we have this oddball site where pidmap_lock isn't taken > but it uses rcu_read_lock() which is surprising to say the least. > Readers could be forgiven for thinking that is a bug. Actually this all looks simple, or I missed something... pid_namespace.idr is protected by pidmap_lock, it is always modified with this lock held. idr_find/idr_find_ext/etc can be called under rcu_read_lock() simply because idr/radix_tree is rcu-safe and this is already documented in idr.h, say, the comment above idr_find() says * This function can be called under rcu_read_lock(), given that the leaf * pointers lifetimes are correctly managed. Oleg.