Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1376997rwe; Fri, 14 Apr 2023 20:50:04 -0700 (PDT) X-Google-Smtp-Source: AKy350a17nPWGF6vKfKI5rjyNJbksfwmoKOmAkjdDhvD8HLU6zYgVcTdDy76N/LSLAYj07Hr66eB X-Received: by 2002:a17:90b:eca:b0:247:1de8:8263 with SMTP id gz10-20020a17090b0eca00b002471de88263mr7752033pjb.4.1681530603894; Fri, 14 Apr 2023 20:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681530603; cv=none; d=google.com; s=arc-20160816; b=TO7ljSmIIl9OO7HysRw/nC4+iNypRqZKaVGERVfJRYnWTuN1MsMUnUdPChEkRUJQwX KVliloLJ7a8ujHZlPLejvy7SYZ4o7SwfGrSiR9FSaTvc3gBuI2t1GxL5lnvX3dKph25h mN9aoJ4YrnxXSVzzdcsCXnP/su+hP5mt4IfRy8vo95YTCAr2u+OsJZ0v9BEGQbANwHFN 11HlkZV/aDMrxcD1Ujcsn4f7Qit7rrr6j9Po/6FXfAR0jVVW/UaxPjl0FV35zBqqeAgF dSuE/dZ8Gyeg9YHykCU1ATkOxpcilQakduyK5ua5HiXrFQka62J6xYy2iEa1UxVY3i+d Cfxw== 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=Jx+Ujqv9xlci3zgOsLm36K4JxBhgxmHYx1AwVD9havQ=; b=gedEi5FTY4rXiEcb6KkVv/g8+Ve3uUqL3QsySS1hNCN69xdGfxBJUrXXtj+tidSlqu wNdjTI62XmbJekOk1XJw5Xwi2xOTdzzO8bTy5bYy+gpGMKNgpC3KTLMjq7dCm+AlddBY 32FM6u/Y/mTrzFEvpgrju4NvalvGPd3K0FYi1yUUVAjnXj3GAh3/5/wmd4qYnFvYiX9d L3yvQrXuAeICRqXg8kCpsKwiu+JwYM9vuHLFO2rGPDqfh3tAZvahYFvzK9ELNN0lEp6x so0rga/6dgtg+YK7LdNg9LrqXmhaofADV2r4YRyx00akHI735Dam6Mp4KSpPZOVaLkMu N2Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kwTyhhqB; 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 23-20020a17090a0b9700b00246be290788si8316984pjr.42.2023.04.14.20.49.48; Fri, 14 Apr 2023 20:50:03 -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=kwTyhhqB; 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 S230011AbjDODcV (ORCPT + 99 others); Fri, 14 Apr 2023 23:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjDODcO (ORCPT ); Fri, 14 Apr 2023 23:32:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4442119BF for ; Fri, 14 Apr 2023 20:32:12 -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 D271B63869 for ; Sat, 15 Apr 2023 03:32:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B52C6C433D2; Sat, 15 Apr 2023 03:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681529531; bh=+XWziO2ua4unQE9zKFAr0FfsCxROiRZNlP1PEGcC0V4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kwTyhhqBaHhovdgbtGcm2bJ6ADe6+zG/8hZF+KwfzHV9UhcaXoTBUvq/WrD+Em6eQ F2MyBPLt/BvcmaWeoFkU8CTWH19xDu35N03OrdsVKObBMcbc/WNfxuCrifnqtmp5Dz AlaCvGVLRhXZTloldkBT5LFZ0WQVTIMltu4lhd4/mwjX5hPWV3Ra5A4gpY65ALjsHc ByiB8zEIvlHLApbU9KjIioeuwc45HvDtZVO+iZQTjgyZw3wajBYcUh8dQ6pMIdB99E n8FXPuAkutINB3TChQ7S9lp5W1LeV/VmevI2DwizELzZDEmimaoPbfvOruyR+q9emN 7UpN8v8nGInSQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: vbabka@suse.cz, willy@infradead.org, paulmck@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Sat, 15 Apr 2023 03:31:59 +0000 Message-Id: <20230415033159.4249-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230415033159.4249-1-sj@kernel.org> References: <20230415033159.4249-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 is having not tiny RCU read-side critical section. 'Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commit da82af04352b ("doc: Update and wordsmith rculist_nulls.rst") has broken it. 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