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: 83627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp750035vqo; Fri, 14 Apr 2023 17:46:26 -0700 (PDT) X-Google-Smtp-Source: AKy350Yl5AA4iv3+/Zui87KxD5Cca69MJ4nSZVl8S8sdGQeEoybFV1ZdAl1TqhLKGbybZqA+IaZc X-Received: by 2002:a17:902:ab97:b0:1a6:84be:a093 with SMTP id f23-20020a170902ab9700b001a684bea093mr3880583plr.51.1681519585952; Fri, 14 Apr 2023 17:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681519585; cv=none; d=google.com; s=arc-20160816; b=df/HYTQohBPInxndvsuaxPXjUc7lupcvBVgkMTDOWM8JpMTuhEQ0JBmj95h8X12FtZ 7305nfyhaYM8uHLFPHXogeDoWk4Y11q0oyUdVDue3PHL1binr40w+QMN8BRaxaghZgbs athZiN6oxsyk18S35JCbwciIPOB1Xh0vVlG1FWFye68/ZzFOjLYU9JbCJ7tSfWXbZdew r3+aMO+71i00vGD8rAlgEbvrJpRwgf0cRNsLBol4ye+qg4y03tQOQs6qQniyLxKUp+y9 HcYsnzA8f8YcA1JvYEZBO00k+qhOX8ZIo4oD2mNL0L9EsfxnAB/Q3r0CdBH+1Go4vnBK CNfg== 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=/jcEvfQQtVBvRPQ2PnEx5l1i3yxHAcPky8oDPHsGMPY=; b=Fo2bIh0JuDifQgIfZJtPIBbYVxhqdCSSloGFUQ351R5WxhEExmw2AFWBYJtDNDb5d4 j0CmKlfo9UtTWGSITJdaOVzgjmVBWhO/4INKwsXOfJuz23PXJDuI+xdzz9Eu6mfhyMHO DRYN20p5wqWEl2iW1p7IQwLW5IErZZ6sSdzDMgcC9SXJ6CcYYLurRYhbcPyWMWd+TtY5 DU6YZSBkMFx22/I0VfgyniIaAUqReM4CdRoBnUGtpxLUX69GSDM1Mhxlr+H/hVRg7+Cn W5HBBvr2ZBXIpXTERaKRZSkZFQcrAHCwJAiQ7F8FHY4QI3acWXid/OzEEUWa7aAHoRN0 ruMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RQRUhO4B; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b001a216fddd01si6191659plr.647.2023.04.14.17.46.13; Fri, 14 Apr 2023 17:46:25 -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=RQRUhO4B; 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 S229651AbjDOAiN (ORCPT + 99 others); Fri, 14 Apr 2023 20:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjDOAiJ (ORCPT ); Fri, 14 Apr 2023 20:38:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E68728A for ; Fri, 14 Apr 2023 17:38:08 -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 682F164B49 for ; 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-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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763201081239816181?= X-GMAIL-MSGID: =?utf-8?q?1763201081239816181?= 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; * } * }