From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B74A8C433EF for ; Thu, 21 Apr 2022 04:22:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF6FE6B0071; Thu, 21 Apr 2022 00:22:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA8556B0073; Thu, 21 Apr 2022 00:22:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B95326B0074; Thu, 21 Apr 2022 00:22:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id A7A366B0071 for ; Thu, 21 Apr 2022 00:22:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 767366121C for ; Thu, 21 Apr 2022 04:22:27 +0000 (UTC) X-FDA: 79379589534.14.E54E441 Received: from mail3-162.sinamail.sina.com.cn (mail3-162.sinamail.sina.com.cn [202.108.3.162]) by imf22.hostedemail.com (Postfix) with SMTP id F232BC000F for ; Thu, 21 Apr 2022 04:22:24 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([114.249.57.134]) by sina.com (172.16.97.27) with ESMTP id 6260DBF4000293D8; Thu, 21 Apr 2022 12:22:14 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 32247649283205 From: Hillf Danton To: "Paul E. McKenney" Cc: Sean Christopherson , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [Question] srcu: is it making sense to recursively invoke srcu_read_lock? Date: Thu, 21 Apr 2022 12:22:11 +0800 Message-Id: <20220421042211.2433-1-hdanton@sina.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: F232BC000F X-Stat-Signature: awjncjftcbe3uwdriz5bczu5xciyay1n Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf22.hostedemail.com: domain of hdanton@sina.com designates 202.108.3.162 as permitted sender) smtp.mailfrom=hdanton@sina.com X-HE-Tag: 1650514944-318105 X-Bogosity: Ham, tests=bogofilter, spamicity=0.183912, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Given rcu_lock_acquire() in srcu_read_lock(), iA = srcu_read_lock(foo); iB = srcu_read_lock(foo); // not bar ... srcu_read_unlock(foo, iB); srcu_read_unlock(foo, iA); can the call sequence above trigger warning with CONFIG_DEBUG_LOCK_ALLOC enabled? Does it make sense to add srcu_lock_acquire() in line with rwsem_acquire_read() if warning is expected but not triggered? Thanks Hillf static inline void rcu_lock_acquire(struct lockdep_map *map) { lock_acquire(map, 0, 0, 2, 0, NULL, _THIS_IP_); } static inline void srcu_lock_acquire(struct lockdep_map *map) { lock_acquire(map, 0, 0, 1, 0, NULL, _THIS_IP_); }