Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4306841rwe; Mon, 17 Apr 2023 10:38:16 -0700 (PDT) X-Google-Smtp-Source: AKy350bcBbTbacrz/M0u4p3kK7TBPwOexZe3BphbYfnXMdWwuCEOupJjBU589GTY4CyYEcTLRLPj X-Received: by 2002:a17:902:d510:b0:19d:778:ff5 with SMTP id b16-20020a170902d51000b0019d07780ff5mr17457469plg.15.1681753096628; Mon, 17 Apr 2023 10:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681753096; cv=none; d=google.com; s=arc-20160816; b=WiAfVLaM23g5+zbV1RAL0DtLXfVY8taG3uKGexXY1/kHl+qf+KV6c3yqSgQdlg5MXf OMP8SNxevogANXV9joz8RIXbM52+K2ZWdZSCDfzNP6AJcWB7Z1VmOXppQoty8XapLkFE kp+DQ+rTkdUgP7Pit4xltD5L7WK5f3mnABnaudYFwPjXLjXDIJu6GL8uIG6ZmKTaNlNc kBYo309HaCWvCM2102ngegOs3hB3D07EDRYStnyIcQNXc7cCEfg8T8qZ8IqPH7n+S0Nr dQtJ/lrz94z3PMdMWqh7xe71KhwwQd7BmJXr1B9+/w1q9kuJvxr5SssTCc1PBsUBHYkg uW5A== 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=ac9HY+UwMkXIl4udhASlu1Iiq0Stde6nwToLb1PxMKM=; b=xSOdMHOnlIDbq4iqBsg09fTGtx6um+6ELhNnzDFNboTEjG2bH00v4UHS4aid1AQzBD X7rbZJ6PKkQcwPp88eH2W7y2WuKOw1QiP+nEK89Nc6MsqZMW5sRwXzhU3mGi9opeQbXn UgtpaSLij3WJf21ilctygJajtWHzYxveeC13H2eaEVOxCkVzGB+Fts7m9DJUQ3JIWtPa TMM3P440OkEyEy/BCZaQixDocF15v/Uq2yGonVIWMQnq3jizAywR8AG9VsxfIa/fvIvM OmwjAlokZPQ0/VxpF+7vxXEyIPLt/JRHL0f9wtbDb3qvDxNW1F6BL+qut+XYCOFXWncw xeaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CzjfofkQ; 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 ix5-20020a170902f80500b001a69eff58f9si9189811plb.235.2023.04.17.10.38.05; Mon, 17 Apr 2023 10:38:16 -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=CzjfofkQ; 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 S229575AbjDQRcy (ORCPT + 99 others); Mon, 17 Apr 2023 13:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbjDQRct (ORCPT ); Mon, 17 Apr 2023 13:32:49 -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 ADDDDAF2C for ; Mon, 17 Apr 2023 10:32:48 -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 35CC56103E for ; Mon, 17 Apr 2023 17:32:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E55B4C433D2; Mon, 17 Apr 2023 17:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681752767; bh=HHLa39ETA/u3pWI5BL6sseaRF5jWhnYjA/pmy+XNmas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzjfofkQ+pPoF44cYauKQrtJKclwDdX4CpSvOCuVuJT+h12RpH2N42m6iz5Cq8D5Z 9p+gTbRcDwF4FSF4jSwBJwI7+2QS/nzO3nEXhVb6Thi3LlJku/EwgVcECSZuRe7Ddl NthKPqW80SkXjBNT2hXuLvUyA4mS+LgRC/MachFhcEgajUP0exf/X0+PwJ5V69sJrz sRYa7ngGRmX3N04NuLePX9INExZaGB++Z57ocFPrMZM4/yZIWfz029dGD7lVqwa+q4 ZftOqD4ytBsZcutFWN8cFSrp2Tn/FAOnrSHsdeyaLPPmLd1DAea9dfrfWCfhR2MUgg Z+FKOP2mO56BA== 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 v3 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 17:32:38 +0000 Message-Id: <20230417173238.22237-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230417173238.22237-1-sj@kernel.org> References: <20230417173238.22237-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") has broken 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