From patchwork Sat Apr 15 00:37:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13212231 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 78AF5C77B76 for ; Sat, 15 Apr 2023 00:38:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14BC090000C; Fri, 14 Apr 2023 20:38:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D614900002; Fri, 14 Apr 2023 20:38:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1AEE90000C; Fri, 14 Apr 2023 20:38:10 -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 D02D8900002 for ; Fri, 14 Apr 2023 20:38:10 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A99F31A0416 for ; Sat, 15 Apr 2023 00:38:10 +0000 (UTC) X-FDA: 80681763540.19.DDAEBBD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 1DEEB1C0007 for ; Sat, 15 Apr 2023 00:38:08 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RQRUhO4B; spf=pass (imf21.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=1681519089; 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=/jcEvfQQtVBvRPQ2PnEx5l1i3yxHAcPky8oDPHsGMPY=; b=U2b7gd2YeCK+nR409WR3k6gpzLUHXzDGYX8ezcQq7jCuFzWD27YhwLuozNJRyD40KYwucN XXTCAkuH4FO+4fj1LwRgXH7SSiFLtVv4smf/NgQEmxS2qeLmYHpB1tHUJ1iv17PyjnG7gr Nnmrxjn9fKpqdBWiFyJYROXx4XaKCQk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RQRUhO4B; spf=pass (imf21.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=1681519089; a=rsa-sha256; cv=none; b=2IlWpHiSPesF0L/GJbGU+6au+nHt2a1jmWdeuM8kGWVe3tpK7vqs0kACgKjrEirJ+1LQpb RAkhSQ85cYpF23NG2tloiFT6BEe7eQ5l0unv9d2UA/LIyv5kCy29Zhx8a8UbFS8EuEYWcL TC4jU+kFI4s7kPN2tqYP3R5clzYOWMs= 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 4BA4164B48; Sat, 15 Apr 2023 00:38:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 645CEC4339E; Sat, 15 Apr 2023 00:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681519087; bh=W5jwPfe3GbEvKKWR+zzbHPFAxqpHbCJnsJu/eHhmiUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQRUhO4Bt8p+Np1+9FS1Nj59CKTjCe8d9cnYKb6XZIsxMJUvxQhlHqae65OBMzA8i YWxisIEN6YNPNQvLj6G37HMUZTY7tRxwBN1uF82A6lMjKhJePduP9R17bWwzMCe/BE ptkG6Y51I5W+H9FPwRHsxkrSAvMw09GqeW33UPuxkSS+B5VJ6IdKDS4eojDfI/B6SR 7df4wPUhmy89w/FJ6JElwUCRboQriSjJ7HfIn9SM/8d/nDocjPX+R/58DPU4z+n9eV nRbK/ZxHc96n67ElviO+PHvWU86xxYfwHjoj4sC7/bQPCaqKOBp6h9gAOLHigyhV2B U4VN8mBVyqrOQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Sat, 15 Apr 2023 00:37:53 +0000 Message-Id: <20230415003754.1852-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230415003754.1852-1-sj@kernel.org> References: <20230415003754.1852-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: fn3rw9xaucoqs3ha7ed5tcjf5jox8tys X-Rspam-User: X-Rspamd-Queue-Id: 1DEEB1C0007 X-Rspamd-Server: rspam06 X-HE-Tag: 1681519088-716738 X-HE-Meta: U2FsdGVkX19zYtUrsD2GrgkPYJCZeSTQcf63IEY2PKRvEfzhFDvkiP/lXEo/47xuphsAlrUH/ipXYF/qsvQga0/DoS3SbMPNA2+JLz8PJvO+rOjdcTtJy0Vl/QPnnQjq6C7RudaIINcsRj3dE6iOwM/w0UQcFCVgiKMaJt+C2rUMG84bUrImDBuIt9S+IJUrHvABOB6XkVQxFkQmNx4DzIUd4oyH/pfQbl74esEixFC+cxOCBCGQBlDQPqec7acKI9nu7Re4vday0WLfedjmqBSqgMUrXB5th9sb9CSf6OlII++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2MChcOqR7es5/qLGPgVyREMurmlvuXE3YN24g== 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index b18e56c6f06c..a2fd57322c9c 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -53,15 +53,16 @@ * 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; + * goto begin; * * if (obj->key != key) { // not the object we expected * put_ref(obj); + * rcu_read_unlock(); * goto again; * } * }