From patchwork Sat Apr 15 03:31:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13212289 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 50CAEC77B71 for ; Sat, 15 Apr 2023 03:32:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE07B6B0075; Fri, 14 Apr 2023 23:32:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6534900002; Fri, 14 Apr 2023 23:32:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2CB76B007B; Fri, 14 Apr 2023 23:32:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B53B26B0075 for ; Fri, 14 Apr 2023 23:32:12 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8733F1A0522 for ; Sat, 15 Apr 2023 03:32:12 +0000 (UTC) X-FDA: 80682202104.14.3536D61 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf01.hostedemail.com (Postfix) with ESMTP id E6D214000F for ; Sat, 15 Apr 2023 03:32:10 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gfAHqZdY; spf=pass (imf01.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=1681529531; 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=G0iQQl2TylCZIUxUAmDzqyREQIW74ubuHN19OfcXmU+MQvW2d+ObylZBW/M5kdW/kxW6CS BB/TnMomESgLkXU6DNfjjQYqG/5SuEeXzJFIm5OchF3+yFHxzjf2ngBxuF9oQpObY2wB4t byajv66E+82fHLrhVCovJ28Hm8T8RjY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gfAHqZdY; spf=pass (imf01.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=1681529531; a=rsa-sha256; cv=none; b=JnWDQ8F1BZRGU/XrOmVhEGhDyjR+5MUqNIFzBU8pnNmH5cak71J2S9kM3vK0wtSwHPFJA8 j5tebhiOFOV2cKRKuo6brJz2mn4qNBkv4v4N1uEKJG8aQAA6Bb0/qDF07drdHywSSmWe6g XqhMkHaKfYLUJf7E7pHkcC1H8n1LvDQ= 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 1579B64A3F; Sat, 15 Apr 2023 03:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 050D3C433EF; Sat, 15 Apr 2023 03:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681529529; bh=Es+n5/VxwrYKRoTO9yEi5YcqrEo9wXUokpGjthhzOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfAHqZdYLDEtDBNe3izGYDVYbHgZDIpJe6szA/ogq2htIeX+b9ERpbUxB6TMIxL0u iNi4MOa0jem3Y/yIE+XIYwVVdw3GgvxjfIzAatbQuOugxH5EFQYOCVkyk9CuzV00NH q8+rxycDEB52drl3fQrIz+Dl7BdGKApw4hiFHSq08c3kTrtWFHdYj69pYVf4+pK0zm wCiN+0Rb72bkl7b4/8LNFQ+uxhDt/VL7CKoM+EEW4lMD4z2B2cNsT6iJ1Ju66wNGs0 BPv3cP+eBH/KhtEaBqKFQ4lvK+lAd7Y4+tUdh+Ok4iC54B3un00hJsch43WLnveedB CDQYMt4sdn/8w== 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 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code Date: Sat, 15 Apr 2023 03:31:58 +0000 Message-Id: <20230415033159.4249-2-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 X-Stat-Signature: wejeamgbe79479p9grezxqq4b5gb175s X-Rspam-User: X-Rspamd-Queue-Id: E6D214000F X-Rspamd-Server: rspam06 X-HE-Tag: 1681529530-660813 X-HE-Meta: U2FsdGVkX1+4rgXUspJOej/RACUBNOLxHGKLQcSjS6w2G0mx+gczuTcpgQ/1wI1Kakz27LHOv/LOFd32plaEX9psXDADnQ8Qnhzz3QG6mKJpyE/ksXVuGPmPLK1NXYfQRi+l2KRnuNyOz3cKvMbVnMVxOS9wsa/CQKm7a2EaHN2TlWR2AcF7+cwgCy9IsCgrOyPRyaLzcKwtJhb9wf7Jt7yqAl+bSzexJM0lwjjhUtACRU3TcSNySBmVQoxLm8xOkS6DwCjs5iVyLnE0u2cWE/Jzec+J3b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7TatEDj6eA84OJiiyuoQ== 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 Reviewed-by: Paul E. McKenney --- 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 Sat Apr 15 03:31:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13212290 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 0EE1CC77B76 for ; Sat, 15 Apr 2023 03:32:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5B5A900003; Fri, 14 Apr 2023 23:32:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 995FD900002; Fri, 14 Apr 2023 23:32:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74D13900003; Fri, 14 Apr 2023 23:32:14 -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 6703C900002 for ; Fri, 14 Apr 2023 23:32:14 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 35D3FC04B7 for ; Sat, 15 Apr 2023 03:32:14 +0000 (UTC) X-FDA: 80682202188.01.6F3F130 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id A16FC80008 for ; Sat, 15 Apr 2023 03:32:12 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kwTyhhqB; spf=pass (imf02.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=1681529532; 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=Jx+Ujqv9xlci3zgOsLm36K4JxBhgxmHYx1AwVD9havQ=; b=zObP+fDMOm9ovxOmQArfjFtkAIHjw6tzCDUA+er4wKRD1sihsZce+6dmJzhiyHHNgYGlrZ FRHB5QkR4InbOOvZb0t5znQH5DHCn2ge3WbWBPpHakf0Z1hwvEmZZw84itCBwdC2TzCdOy Y26RiiwgIo8xDjb4h0eVJiCnteC6MWA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kwTyhhqB; spf=pass (imf02.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=1681529532; a=rsa-sha256; cv=none; b=4bFb4FQXk6yNLE5e4ECzgy8tD9XGQ7xNiX4H0pgZdyJ7QioB8obfioJRlVxgUhz6GDIsg2 y7nkdDK6bwypyWhtU7FZcIliK8G4hPsGfNb5o+ZO7msge52Qasoww6n8GjN86Z4JUwaiZ5 ZfvBjexD1P8uqBBN0OUyWoVs52GqwvM= 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 D5BE2649C2; 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-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RQVk7xbFLdk526BEnqIh2s5OgvObRf nHNfIn0T lC1v9X+8fm2IaBI79Mq335oXNqZvOMy1cEjK0Wihx/PM2p3sWsuFwo9NbHpJTJvHb7deKfakiztXgN8pwt1A2AD0DfPWutQo60qMs5QQhFcloW9oqPdCq2PU48JNQrJodkveL/fxi2hyCYPKROiW7iM/IdMVx2rDMBrCQyx7qny+zsNIpU5elgFxVgMs3NVIXYrW2f9dVDxhNZ8IdzXLMjVbLPHCFH01e1nmwYyFNp7EXmzUo56reb1K72Dqh5MASgG2Hqr/HF0mEWvQUJswH8ucxcTRQAFF4ZyWqxMPeURoUhrpUhYf4UHTC7nOawCRtlKK0uuYNw7R4OA7AP0OSBiSEDrf4DumzlYgtGurl0sFpIVxZ97gmfZLVOldD8unqCm8FCCMMjUDmGB3MfBkuJUx0PA== 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 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();