Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4425209rwe; Mon, 17 Apr 2023 12:26:47 -0700 (PDT) X-Google-Smtp-Source: AKy350bI+yqczZnrNHBrFhfBMwLgrC4XGK2y58f5zeqOmoB/0nmXcAsVDbTm8Pze3reX7EuFAuRx X-Received: by 2002:a05:6a00:24c4:b0:63b:5496:7af5 with SMTP id d4-20020a056a0024c400b0063b54967af5mr23331906pfv.1.1681759607359; Mon, 17 Apr 2023 12:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681759607; cv=none; d=google.com; s=arc-20160816; b=Yo/S7+nVY85psbw8hd3vmBVlC742cE7qVsoH+KBuQJnIiGw+7o8kJV64FowsOk3Sj/ xnTXYNYEf8yUfaJPXZYaw2/C0UOXp9Yf8mVibNFp2Fub249qT4NhePeeqVMXQv0fW4qP 8F3nAgYomB+d3K8TdX8kWG6hBwrWuik/yEQWxlKoBG4jq7YAsfXIv0GWVAv9ToYhVMAe Fv4xIRGxhVIPuR9YUkOuKYHx+A56NPiAc+Wwa1VGLP1vkwcl/HWFCU4SFYaj3F4tIZWZ A8srMd6i2QfOXavSAmnynxGtRwfgDRWZyR4HfwLa1H15SpaEnb2wDshHnD/RXiA3wQnH ynsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8c5dtJg49yuAOjOaXZXSt0ooFdoT+EITcXmk3BzXFqo=; b=g9JD0DG7esUM/Ud9cueQ7WVyMgm19IMUbp2ahY3e291gHUahp8z9+hKM4RFG4f3RxV B36quef+AsWfYV1LfMGBFHPzt9EwholS0kSyCvHy2Kuw+VqiGG6ueUprqu2YUyrhGmkK MVIaKGXzgyRSou9SRD2ZR/tIqkSu42ykfk6Co2u1tT4cTBf0QnawyVJAp89Agp4xcyxy PqWphAAL8BzDHmVD8uhZFEO00loNgX34PBj0VGSjUCOTZa3CbwX9+bEZhMuOEncUysHR UB9YKpUXdrQ+Ef5QBBsF+LGO4VQABB5qEjlvHOsUzxYxhhOaAKnDmaI6PD/POineAQ2O h03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dmjUVyzk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a630b11000000b0051b4f835d5csi8913515pgl.26.2023.04.17.12.26.33; Mon, 17 Apr 2023 12:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dmjUVyzk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbjDQTFC (ORCPT + 99 others); Mon, 17 Apr 2023 15:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjDQTE6 (ORCPT ); Mon, 17 Apr 2023 15:04:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93F021FF3 for ; Mon, 17 Apr 2023 12:04:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2A922623F0 for ; Mon, 17 Apr 2023 19:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D49D6C4339B; Mon, 17 Apr 2023 19:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681758296; bh=WQfGLRATu5yNqviGHfeBkCPNz4Cl1WILm/qvutnMXWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmjUVyzkqRGC4Yojq0nM+pzKAoFDXDU3sVCdhZ3hv2uEK5wjYbcmA3aTqHR+GuGh4 uEct+GTMJZbVjpj5FAlkfhw1EVUoO7XvwA0m1qaNQOkDbawzVhGrZfU9wkL/e3A2Nl jOGKt40oSlBMO2ZkGesT6jY+Mz6QSKGQEJ6kGbb8A2x8+10XVbMdhbJLYEWKWl3TgS EMSeGVNi9cZ3LvKM0rqDRcNRqrvXgcEbZU0UQehUPp2UDMFVE2XQWrl0HldWnRwgNO 1kyLYV2jiJv1yz9VGjAXR6a+zhEWjYF7P8pjnlnMW3k2DY9TWQKx94lB9ZUCVlVFYs CkenS7BaVQY0A== From: SeongJae Park To: akpm@linux-foundation.org Cc: SeongJae Park , vbabka@suse.cz, willy@infradead.org, paulmck@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 19:04:50 +0000 Message-Id: <20230417190450.1682-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230417190450.1682-1-sj@kernel.org> References: <20230417190450.1682-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SLAB_TYPESAFE_BY_RCU example code snippet uses a single RCU read-side critical section for retries. 'Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commit da82af04352b ("doc: Update and wordsmith rculist_nulls.rst") broke it up. Apply the change to SLAB_TYPESAFE_BY_RCU example code snippet, too. Signed-off-by: SeongJae Park --- include/linux/slab.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index b18e56c6f06c..6acf1b7c6551 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -53,16 +53,18 @@ * stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * + * begin: * rcu_read_lock(); - * again: * obj = lockless_lookup(key); * if (obj) { * if (!try_get_ref(obj)) // might fail for free objects - * goto again; + * rcu_read_unlock(); + * goto begin; * * if (obj->key != key) { // not the object we expected * put_ref(obj); - * goto again; + * rcu_read_unlock(); + * goto begin; * } * } * rcu_read_unlock(); -- 2.25.1