From patchwork Mon Apr 17 17:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13214400 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 8B5C3C77B7C for ; Mon, 17 Apr 2023 17:32:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 275086B0074; Mon, 17 Apr 2023 13:32:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FE326B0075; Mon, 17 Apr 2023 13:32:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ECC78E0001; Mon, 17 Apr 2023 13:32:49 -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 F2F0E6B0074 for ; Mon, 17 Apr 2023 13:32:48 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A512E1C67BB for ; Mon, 17 Apr 2023 17:32:48 +0000 (UTC) X-FDA: 80691578016.03.6AF35DB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id F0CD01C000F for ; Mon, 17 Apr 2023 17:32:46 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rlH9lbkO; spf=pass (imf20.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=1681752767; 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=Ti1Iw/BkTnjfHdxTnwEp7G/C+CJupjGQJ7R+jgWZhFTXSMnxbI5eIjUX/yx0um0J5+ypdq z1aywX7cjoBzTfVSj7NawqvGOyHCbSyt96REdxNL59icMbvNKVhSWdvV3DRC/hMEsWLa12 Pl6FcU6KQcIPHmlA7cYtb5MkzBChaws= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rlH9lbkO; spf=pass (imf20.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=1681752767; a=rsa-sha256; cv=none; b=It4SeZpXqmZ2yjnhjQb2P71b4qijsJMMtBV17IX7oIi0cqKk4VsGDzONrYQ6rJt3V5JBaE cPWyKbO/aLag7x2G6UMwqiPyXTbvyhNyq7tqRZXLlnST9xOTATzAoie8y2gCeI4m8sigM4 7/PYph8ByJ8JdZRyanfokMz2p/FUQoQ= 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 217E862224; Mon, 17 Apr 2023 17:32:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C786DC433EF; Mon, 17 Apr 2023 17:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681752765; bh=Es+n5/VxwrYKRoTO9yEi5YcqrEo9wXUokpGjthhzOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlH9lbkOVcwAIisH9F8THoJkl9K3xhlyWm4TKUEpm0Vkt0daWLvdvBbBuU4a4O5og BQ0fDOAAL3fC2ZidRrTB5pTjTklr7INrTAUDZ55/Z83W9/zYXenLaUCmGXxPyJtcLn zyImTrcCWxER+WZG4HbmSFAkieQM/VpLkf9dFQIoieIpbPrhrcVQUY7kiyWy41VCBR YpSFMK+ugQzbOxB/dADQa4/7DXVp1+ImgTOeAh3qW2CQYQYBsCZ51ckqR1JZjUUjpY KYsubIcX4mIJj6RbrYq1Og9GVI6q/L5Ys7dW7zpgw9OrqvE5fnT8YU1jX3zjIWFa1Z NmNggbU7Kq85w== 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 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 17:32:37 +0000 Message-Id: <20230417173238.22237-2-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 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: F0CD01C000F X-Stat-Signature: 9fcpq39dayt1jps79nxfrgj8u95o6mit X-Rspam-User: X-HE-Tag: 1681752766-74887 X-HE-Meta: U2FsdGVkX190MNEhHLEqy6b1SBoIQoJdnR1N8OMmhH3yW9z2NAptYjZOAC4MHL1XaEgreVodOroM3aR27pSbvEdJiNuREkkIO1wQkm7caWweFxw97ZesYRuiJGW2qfmeof0/vMKLnUdKUgiqxSPQxgOOSZm6/cBqLvDxs5EozvgjvxKQ2VaAwxA4lFMTcIJR5Dd5fm0vmDw2XQyN6izZyk9LI7Nb/CoIwtH/nOkT3YM0Kbk9o07tGjUJ5FtH0DJuFlgg0OVVIAXWh1AGDtni/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lhlt9MuB8wQqmTvJWysc0iHBsvxmfqLZuWzrDPczTD6HwD78VGg== 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 17:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13214401 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 DF55FC77B7A for ; Mon, 17 Apr 2023 17:32:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 389D96B0078; Mon, 17 Apr 2023 13:32:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E91A6B007B; Mon, 17 Apr 2023 13:32:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B1B98E0001; Mon, 17 Apr 2023 13:32:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 042486B0078 for ; Mon, 17 Apr 2023 13:32:51 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D0C001C6669 for ; Mon, 17 Apr 2023 17:32:50 +0000 (UTC) X-FDA: 80691578100.14.F303B7E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id 2566A160018 for ; Mon, 17 Apr 2023 17:32:48 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CzjfofkQ; spf=pass (imf08.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=1681752769; 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=ac9HY+UwMkXIl4udhASlu1Iiq0Stde6nwToLb1PxMKM=; b=hBuignugDTqllKMwa0y+0mj8vVRxPjZr8oUXEBtYo9ybcetY5pkfSskn9caK5jn+yncMj9 oNItT92odqe+LoD0zpBlcnKPCAyx/Q6Dief7E6yPbBeHkDNVhch0uRP22DlPrkcJRgr2KX zYn9iugK6gCsV7zaUfMcvFKUa0zIEos= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CzjfofkQ; spf=pass (imf08.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=1681752769; a=rsa-sha256; cv=none; b=e8xw4Xf0f4rf8e7NYzfauo8qv6QXvc1DYG5ujzG6sAsrlTBgT57Lcnwa2RgNj+K3KuBI6v +nSjsrmSpKQR0MtKMCiueIgqIvefqNHBy6mXzcPF+OcrTPaL0dupzpguLwVuhHXklasKhk p39hA5rD6qU/CAFweISfx6xbesABeKc= 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 39DA86234B; 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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+67aliUvhBXu8BVW03TpWE g6sunXPO ustJkThvU7cCIRfa4SP32hMSO4NAmgmtXmOmeQpoufNz1/U4uBlMl7Eh+5z9XORv+ioMW+VZzT65ZatCK66SnY0VKV2bzPmxvPSLndK6LhqPs1dGwpZWcPSNXmDDao/XN0JV5OVIDbVMm7jNJp8l4/OEklxJtCVsVjtO/jDdCj3nmzlCVwXyLWT2bBn6PdIspuSwhSLjgZWrLQHpj8ipqXaHoWd8rhxcwMOfcztCABeZVmgxaMnvbhJhr/QiBZMI2O4jZ80iHiDQOTjpn/sWdzOag84vlVF48urO6VF8e3TvFTW9QhZyTLTIKQbgxIxAIsE3auvVkomAAEc6EGp7rBdVWPDuxlQP51n22EZYlHnO4MGXit7/Sh59CZounl/9aoXhDHGLjm0eBO90ZHoGZ/LGOEA== 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") 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();