From patchwork Sat Apr 15 00:37:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 83626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp749448vqo; Fri, 14 Apr 2023 17:44:45 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/5iB57k0NLCxnCtIuNW5p49o+TVkriCBZ3O1ALCy5614AEHQ+Rq80NicqxIX9d7+wyLQv X-Received: by 2002:a17:903:4281:b0:1a1:bf22:2b6e with SMTP id ju1-20020a170903428100b001a1bf222b6emr4662428plb.43.1681519485380; Fri, 14 Apr 2023 17:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681519485; cv=none; d=google.com; s=arc-20160816; b=G/sN7TbGmU0SBTPdOHCeelLHArmG3dZeakVd1FTVRDXz22vC8IhGVMyXpcZBPZGwoQ 5x7g2DCIi7Pa/DbfThvFpHOkBnrN8HjLtap4iOX+/4+XGuYzZHfABTgWgD4vT/cgaCnA k+P6FE/VKlOWUpkjtMmOHdkcDbjEpozCNLhWaBnEHTzHpcOjHzzTSX5G9NYX9M2S2kFs h9BHhltHvEDYfNiajWFdCaWDzqQElf9dwutNOCGbWgcdUqZm5H/n9VeE/5Bc7uVQXVUS 1wCBHKdMeA8MRn1HDDq364Z8jIjyIu5OsCOV3UxvUVW0CHGB2vePlvavQUZvCKyE8CTQ bcqg== 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=MhTz6d6oVgpFx/Sb9wUAPGcWrqLArJdIllPwx5eQr0g=; b=FIM4E5cZfoxdG/CKiDTTge8TuLvXxi5Ptx4f7yxG3gAs5iWHXgOH8hQI7K8vaF6BnC FeFFs1+NKh7QVLsBcCfaxvZry6cvLh0GLos6GlD9rh94DK8l8GJ3SOOptNLhdu6e1g3t Tc7gOEbQnJYZB3HnrgIYEI1xOlh0y8ueFXAEQ51NzdyK7ASPuoT4LRT5az4+VqoYzpkf EbeWS2CYg5WfFT/y8wy1jkEaqOgDisytW7W93LXzSfFpgC/b5of2WT8Q/ramtoUKT4uJ 97oL7yOKT0wZrPO5yfqB6zkTupZN0uo+1UUzQCdszWtKM1VUlVGM323yNYwWnEU0jJKS vNqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NBcuk7R/"; 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 v135-20020a63618d000000b0051813c6dbdasi6133130pgb.7.2023.04.14.17.44.33; Fri, 14 Apr 2023 17:44:45 -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="NBcuk7R/"; 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 S229780AbjDOAiL (ORCPT + 99 others); Fri, 14 Apr 2023 20:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbjDOAiI (ORCPT ); Fri, 14 Apr 2023 20:38:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE447D80 for ; Fri, 14 Apr 2023 17:38:07 -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 D083364AD9 for ; Sat, 15 Apr 2023 00:38:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E298CC433D2; Sat, 15 Apr 2023 00:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681519086; bh=Es+n5/VxwrYKRoTO9yEi5YcqrEo9wXUokpGjthhzOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NBcuk7R/SX1FJHH9tUOzXxSzgOXFK5Jqi5KCLIAbzLZtDX8DdLN45vwOdbrn1N1Bd ISFzPFRifzqI3bAVZzGdl/W1i5fyj7JBkfcRYA6n5DohQ6mh2Ix3ROfzk831+gA0ZR bRSv3oYmsL6/IWhXgz1fKZVmbVInyF7xieLyHmQjX6oC0Xc2afdRsl6x1z+/LDnExG 1+CQygGAwJFtemC6iFzc9RhEWz1lNHq3Mc/sKmuLymiUmppai4Mh+/fRUNHarwkHb8 uLzBIfFqYcUXuzqJd9X5Z31m+r0KoTaLCL7r9iW38GqiwmhGGHihJmJ3FINdoI30vC bPR3UO5U7u5CA== 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 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code Date: Sat, 15 Apr 2023 00:37:52 +0000 Message-Id: <20230415003754.1852-2-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1763200975516043339?= X-GMAIL-MSGID: =?utf-8?q?1763200975516043339?= 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 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; * } * }