From patchwork Mon Apr 17 19:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13214454 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 D1A1BC77B7A for ; Mon, 17 Apr 2023 19:04:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64BC36B0072; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D4188E0003; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44F758E0002; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1DB5D6B0071 for ; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DEFDE8064F for ; Mon, 17 Apr 2023 19:04:58 +0000 (UTC) X-FDA: 80691810276.23.F5D1F14 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 3EE951A001C for ; Mon, 17 Apr 2023 19:04:57 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RgJKJZP1; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681758297; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MhTz6d6oVgpFx/Sb9wUAPGcWrqLArJdIllPwx5eQr0g=; b=8dPAuXO7i2pRcTAMpwTslj0OM/zmzj1z025aTamE+jhusZXZxXdTxYRXeCOTD8+7Sd/8PV kM/UXez6M4llrwHoE/+/gnUkvLop+HEQjOy/+o6wlKOa1Fl1OYKpPbMADgIbc5LkvdvsHP a1BUd92G4ZaVDNgsYPtoSSdEW955bzA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RgJKJZP1; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681758297; a=rsa-sha256; cv=none; b=Au+pHm7MU1l3WoguB6heCcR5VaIsDbvSlnYpZe2m0LLExgtseogl502Tl6BhnfFp3DEPVQ DnWErJSfJ2SNR7Xw+w5VeVEzqe6/I2fpBTgb9UX8PoWVoQEVoODQTzgOQBZk1oEYaMAydo 47jPGC530iiC7q74rvZrZ7qvwOKq7w0= 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 6360D62720; Mon, 17 Apr 2023 19:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26228C4339E; 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=1681758295; bh=Es+n5/VxwrYKRoTO9yEi5YcqrEo9wXUokpGjthhzOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgJKJZP1Azyy4TtIdtY0e/Vw4MOdCwh3eRMrek9xlz58FkybYo90JfWDYWNFJRSPb SvesEN8BOVV13SyBwJeCHr9I3f0QTJRJ/TO0n7ftJKweAqvON4UY9Oah6ITeQLbdEI /MoOTIOoyfX//GONmpP6fAv3wXfANUVJMyxiY1UXRzpS8E4zBFvdWmOcmcd38/4737 aq1RUS5eDBLgw6qTLA4zxqYK15kxqBKssKv7QidaALrYpqnv70mCyD0irRUofeQa0z QNRiXIBy1kh+Bk36UqyzHT+U65H7+AWL3CcUd3Ac05fzEcVeImSdl0zrhRksOXJYPr Cq4PNInLJMXBw== 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 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 19:04:49 +0000 Message-Id: <20230417190450.1682-2-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 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3EE951A001C X-Stat-Signature: 49japotxjc43hh9he4kbtx89m8q46rmn X-HE-Tag: 1681758297-400315 X-HE-Meta: U2FsdGVkX1/escHL6GDyYGHaInCFxQErEej5coScDyKCO1wMkzvheoz3AJ/ix7rOv23LGIFTjh7c5S45JY4MMrITCSCk+L5w3dfDljtBEKHvmix6u7tpoWQHSYzinVtNAO6IDIIoCIBrMMyA62P7sQ3Ydi6XNp7H72eSNmVDE72iZDqN4pkQPUSTajOs+nNAWGx5M584USTLFxQ8+nfyeVQpqK6Juf49D7oWzXf+yhZJUZ8GdqCRTKqWpKmJObbJ0rhj5sDJpBYAFUZz6lUCR0/JkZthcV4QJjrCPKliUK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OA4qs1A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: An example code snippet for SLAB_TYPESAFE_BY_RCU is missing a semicolon. Add it. Signed-off-by: SeongJae Park --- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index f8b1d63c63a3..b18e56c6f06c 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -53,7 +53,7 @@ * stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * - * rcu_read_lock() + * rcu_read_lock(); * again: * obj = lockless_lookup(key); * if (obj) { From patchwork Mon Apr 17 19:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13214453 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 465BAC77B78 for ; Mon, 17 Apr 2023 19:05:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A913C6B0071; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A40FA8E0002; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 649916B0071; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 310DF6B0075 for ; Mon, 17 Apr 2023 15:04:59 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 069D8AC366 for ; Mon, 17 Apr 2023 19:04:59 +0000 (UTC) X-FDA: 80691810318.23.84975A1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 600B6A0013 for ; Mon, 17 Apr 2023 19:04:57 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=dmjUVyzk; spf=pass (imf15.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681758297; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8c5dtJg49yuAOjOaXZXSt0ooFdoT+EITcXmk3BzXFqo=; b=t17lY2CbWUi/Il2Q4see5tYUU3E3W7k4iZXK3otK3p1pCkaqGzKjOCwOqZfp4x5u6HEBgG dwyulKEOqOEA5TrHyprr8/na2WdRPbHzGwVYCvNk0cZMxgczBv5pzgcDOBLE3w1THk2Rh7 STbxMCH6KzZ7Srumqdnkr8H5/Hx45Fk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=dmjUVyzk; spf=pass (imf15.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681758297; a=rsa-sha256; cv=none; b=UbFDp+Q9rYVk2cIoqGxfx1Kqzne5Vdg5YCNCqHrP0UzgALdqp6sa4KqlMvakqX4zDOyizF MvZDLONuV3H0w7HDBviy4UpHrt7zjrMX4mJEx5dibMvO+DfX4SXG58jyhriBHuCJmMkzns XjPI89R/53bjAxZGF1N38NeBDFA9AMg= 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 982B2620AD; Mon, 17 Apr 2023 19:04:56 +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 X-Rspamd-Server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6vJC11pQd/wEm7QVJp IQe4DeXD +CmOnBTwnJF7v36Mi8+XDsvI6E9fjaf5w70KPQpn1zAGuPOPvjlospSRkSN6795qAes1M4LQgEc0fYZ71LNcDIkJmD4G2aSZf7lLpeeSPqI/ipvy7+bxL/ln27NrapR12THQM84DS2ONhKb2k/ipVgxg9Bc8eUm5+HgztCHQ/ToRbvbQorboglBpxlfP0pj7ZJIoFveHaQzCHuZ05Q5fJlXkSSACML35YaUkO1XUfSO2KKDKXZSJAUgvHQTrdilvSUIwCosp9evBP0Y3c2dnKEWH42jUcL8o4/QuHoob7kniwPnXpyonTEh2vA9ipodYxrGzNbkLa9btSShfecThQWNIocdv8H9jkEJbHHNPleo1ebDch8OxwwWvZOe0BHRkY36PaL3Uioe+qjiq9KwrPZwdcsA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Paul E. McKenney --- 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();