From patchwork Mon Apr 17 19:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 84415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2349085vqo; Mon, 17 Apr 2023 12:17:15 -0700 (PDT) X-Google-Smtp-Source: AKy350YCCqUucI1cL3Wg/sN2cM8p/jUb3EfhFcXAC7CkTlA8y3XXVS9lx3YyWPVlxvPHTo7U28uL X-Received: by 2002:a05:6a00:acb:b0:63b:854e:8459 with SMTP id c11-20020a056a000acb00b0063b854e8459mr9583649pfl.31.1681759035217; Mon, 17 Apr 2023 12:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681759035; cv=none; d=google.com; s=arc-20160816; b=JOoYI8qnE62ELywgbbJrhs/LhZPgcso0n1AyrRAMX7bIQYyuzszTIbWO9MFZZrEZQH 5cvOx3uni4ZaD5zLOZfhN+N49mKRVwIAjhesZMCAqJnMCSoLOrfVMqC7gQT9APkFuW3d zT8ZTnMTyeqms9nxFpBa76Wcm7DqBIsGDW7B/mMSB4jR95IzHQSC3PxY5Uw8CNt80eDJ AkPu0l7teoUXgpL1w/QdG8zM1vLm3omrIoSK3wznAF4EQfGLVuBnOgyd4LQLc9pkSQCn WfJnDFtT/kwdcPgxepVNK8GMdx/rVHNyr0EkWx7D8/dhz5PZZo0oki0Pvwt8cEMyLQMb 0qUw== 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=nee6hQ7oJA0FV/hgS0YppZ1ZPwPefhPYmZFfNx/zJndSaRaLES1fKKwE126Bc3Hy7T 5Ek29WE7nTe/SI2HPj3TOq9gMbweWBZRPMXm/j3aj1dyGgmal1stMxWnM/YIvJgz5ma8 e2Hw4hOsF/7gjynxzqlq6OZeXBwOV/W02AQhZUzuLgF4tBmuRoBEZ8D7i80Fw6L7rXFq kcRlQSdVqGAcJyB4toSZKGigSZqrIoNc0Pc8xY5gx+AqFODFLYPMx5CABjoPvSCg5Lf9 3Niycam75D/L1ue+ZFAcBvmmGTRga3zjm1p3UNcWHjXaujBwqkjFFbAPg9btZGVJUq3z gTlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RgJKJZP1; 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 n6-20020a63ee46000000b0050f55427e3dsi12647344pgk.701.2023.04.17.12.16.59; Mon, 17 Apr 2023 12:17:15 -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=RgJKJZP1; 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 S230307AbjDQTE7 (ORCPT + 99 others); Mon, 17 Apr 2023 15:04:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjDQTE5 (ORCPT ); Mon, 17 Apr 2023 15:04:57 -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 B9EF335BF for ; Mon, 17 Apr 2023 12:04:56 -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 557A462035 for ; Mon, 17 Apr 2023 19:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26228C4339E; Mon, 17 Apr 2023 19:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681758295; bh=Es+n5/VxwrYKRoTO9yEi5YcqrEo9wXUokpGjthhzOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgJKJZP1Azyy4TtIdtY0e/Vw4MOdCwh3eRMrek9xlz58FkybYo90JfWDYWNFJRSPb SvesEN8BOVV13SyBwJeCHr9I3f0QTJRJ/TO0n7ftJKweAqvON4UY9Oah6ITeQLbdEI /MoOTIOoyfX//GONmpP6fAv3wXfANUVJMyxiY1UXRzpS8E4zBFvdWmOcmcd38/4737 aq1RUS5eDBLgw6qTLA4zxqYK15kxqBKssKv7QidaALrYpqnv70mCyD0irRUofeQa0z QNRiXIBy1kh+Bk36UqyzHT+U65H7+AWL3CcUd3Ac05fzEcVeImSdl0zrhRksOXJYPr Cq4PNInLJMXBw== 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 v4 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 19:04:49 +0000 Message-Id: <20230417190450.1682-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230417190450.1682-1-sj@kernel.org> References: <20230417190450.1682-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?1763452162222217433?= X-GMAIL-MSGID: =?utf-8?q?1763452162222217433?= 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 19:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 84414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2346247vqo; Mon, 17 Apr 2023 12:12:00 -0700 (PDT) X-Google-Smtp-Source: AKy350Zv25MPj9alViqGMsXtBBC7pTeZN/NuP/0BcE780KhrST25mtuxDIoC5d6bF3FXUItkVfnv X-Received: by 2002:a17:902:daca:b0:1a6:77b8:23e0 with SMTP id q10-20020a170902daca00b001a677b823e0mr17049271plx.60.1681758719431; Mon, 17 Apr 2023 12:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681758719; cv=none; d=google.com; s=arc-20160816; b=bUo+oqAnj7HF/5gk+iYzL65HeCKC2rz4UD+Ci9Dvs3n8YIznJ21vWtDVejALmowoPE DsdlSUZcO7sIT5EulT48aFKM9tE6LUz/2QNgWq/y+BeUNqUmdt29GrzkitVLTkx2gy0M fhAOvVgsqk0m89h++lpDyRpEZ/tNqwiCby1+PfBbm4OcAIlW5VuLR+pl2Ofs9g31XfDG MzOyLa8fKX1JsAbp8B2n2LIy9zziMcc0wFR2/KZU2NL3XnwqDLEHyiuJSS2EBgxC+B6H s+lucBNvJRPfoCg8fIfdtAn66EMezYYgd42uVFdB/+C/Goe7yR4f4wkFbf+nR+k+rP8Z 2e6w== 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=8c5dtJg49yuAOjOaXZXSt0ooFdoT+EITcXmk3BzXFqo=; b=g9JD0DG7esUM/Ud9cueQ7WVyMgm19IMUbp2ahY3e291gHUahp8z9+hKM4RFG4f3RxV B36quef+AsWfYV1LfMGBFHPzt9EwholS0kSyCvHy2Kuw+VqiGG6ueUprqu2YUyrhGmkK MVIaKGXzgyRSou9SRD2ZR/tIqkSu42ykfk6Co2u1tT4cTBf0QnawyVJAp89Agp4xcyxy PqWphAAL8BzDHmVD8uhZFEO00loNgX34PBj0VGSjUCOTZa3CbwX9+bEZhMuOEncUysHR UB9YKpUXdrQ+Ef5QBBsF+LGO4VQABB5qEjlvHOsUzxYxhhOaAKnDmaI6PD/POineAQ2O h03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dmjUVyzk; 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 c5-20020a170902d90500b0019ce4e2be99si11062763plz.193.2023.04.17.12.11.45; Mon, 17 Apr 2023 12:11:59 -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=dmjUVyzk; 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 S230317AbjDQTFD (ORCPT + 99 others); Mon, 17 Apr 2023 15:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjDQTE6 (ORCPT ); Mon, 17 Apr 2023 15:04:58 -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 93F021FF3 for ; Mon, 17 Apr 2023 12:04:57 -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 2A922623F0 for ; Mon, 17 Apr 2023 19:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D49D6C4339B; Mon, 17 Apr 2023 19:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681758296; bh=WQfGLRATu5yNqviGHfeBkCPNz4Cl1WILm/qvutnMXWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmjUVyzkqRGC4Yojq0nM+pzKAoFDXDU3sVCdhZ3hv2uEK5wjYbcmA3aTqHR+GuGh4 uEct+GTMJZbVjpj5FAlkfhw1EVUoO7XvwA0m1qaNQOkDbawzVhGrZfU9wkL/e3A2Nl jOGKt40oSlBMO2ZkGesT6jY+Mz6QSKGQEJ6kGbb8A2x8+10XVbMdhbJLYEWKWl3TgS EMSeGVNi9cZ3LvKM0rqDRcNRqrvXgcEbZU0UQehUPp2UDMFVE2XQWrl0HldWnRwgNO 1kyLYV2jiJv1yz9VGjAXR6a+zhEWjYF7P8pjnlnMW3k2DY9TWQKx94lB9ZUCVlVFYs CkenS7BaVQY0A== 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 v4 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 19:04:50 +0000 Message-Id: <20230417190450.1682-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230417190450.1682-1-sj@kernel.org> References: <20230417190450.1682-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?1763451831009747982?= X-GMAIL-MSGID: =?utf-8?q?1763451831009747982?= 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") broke it up. Apply the change to SLAB_TYPESAFE_BY_RCU example code snippet, too. Signed-off-by: SeongJae Park Reviewed-by: Paul E. McKenney --- 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();