From patchwork Mon Apr 17 17:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 84365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2292775vqo; Mon, 17 Apr 2023 10:38:30 -0700 (PDT) X-Google-Smtp-Source: AKy350aa6PAK+eKhFk5Xq8/Q1SwKUu2c007dOcX5LaF10a9eUHupGmMMjnVKCJPtuhR2YEKRYXY9 X-Received: by 2002:a05:6a00:a25:b0:62a:c1fa:b253 with SMTP id p37-20020a056a000a2500b0062ac1fab253mr22880821pfh.31.1681753110364; Mon, 17 Apr 2023 10:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681753110; cv=none; d=google.com; s=arc-20160816; b=x48+zY+k4lSyfknpyB3hd3farcaMZQyGBX6HUUqnpfWLz+ZKcvZd40w96w3l+Dh3n/ 4dGMFCfisHRJ4HRYx16nj2/TwuFvR6TPcAssyhLbLsDl7pyp95s59f2Gvy+o4abVDwgg X+7X/TbSC/6zkdFo7v85TRaCYBKVW6ETXOk+cDFemLBaEijxCrhDd6N49Z5qKYXeVhqM blsTkOApAubIiS6jen0JU5cqnKoTe0m/4YjCERvGCm53jOCIp+afI8p6CvKuVVE5puvh 9esgsrdPao37WkIfy6EmvpaLshQ1UAOEBWf/Jd3oeQSTjve3+ivA1pJNGf1BbWaDaISN kgKw== 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=FE8gdgWIdCZ8WsR/mNVwDlV70OmcWu6ZH1oKfFNb3f70sFCm5fzRQkHNjycp6Jt/bX OfqIWGkCcPJhW4JsKbhSo8e3tqnBVaclCMULScYzB4tAyTbvxp1gtWp0FSaWRUNJVumm VyD1W3e2FfaWsJCnjl6s2cn8St0AFdvbOM+h1YHolHrnZA3djqTDwC1DKX6J5zmiOqb6 ml5AJi955DK1DiOtumsYWAzbpVaygkDupWAfbbJWS9PPtx2RtPJc5hzpsWKzhBsg/ut0 zFpOutX1I8HFVngZ72M8jzfbjAc9mMUuLDIYzhblwby4fv6bmLhdm+FDR0ZCGKvD2W6H OQHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rlH9lbkO; 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 o25-20020aa79799000000b0063d2e0cf58esi1123807pfp.10.2023.04.17.10.38.17; Mon, 17 Apr 2023 10:38:30 -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=rlH9lbkO; 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 S230296AbjDQRct (ORCPT + 99 others); Mon, 17 Apr 2023 13:32:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjDQRcr (ORCPT ); Mon, 17 Apr 2023 13:32:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A92D4E76 for ; Mon, 17 Apr 2023 10:32:46 -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 1F384621AE for ; Mon, 17 Apr 2023 17:32:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C786DC433EF; Mon, 17 Apr 2023 17:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681752765; bh=Es+n5/VxwrYKRoTO9yEi5YcqrEo9wXUokpGjthhzOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlH9lbkOVcwAIisH9F8THoJkl9K3xhlyWm4TKUEpm0Vkt0daWLvdvBbBuU4a4O5og BQ0fDOAAL3fC2ZidRrTB5pTjTklr7INrTAUDZ55/Z83W9/zYXenLaUCmGXxPyJtcLn zyImTrcCWxER+WZG4HbmSFAkieQM/VpLkf9dFQIoieIpbPrhrcVQUY7kiyWy41VCBR YpSFMK+ugQzbOxB/dADQa4/7DXVp1+ImgTOeAh3qW2CQYQYBsCZ51ckqR1JZjUUjpY KYsubIcX4mIJj6RbrYq1Og9GVI6q/L5Ys7dW7zpgw9OrqvE5fnT8YU1jX3zjIWFa1Z NmNggbU7Kq85w== 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 v3 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 17:32:37 +0000 Message-Id: <20230417173238.22237-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230417173238.22237-1-sj@kernel.org> References: <20230417173238.22237-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?1763445949285888228?= X-GMAIL-MSGID: =?utf-8?q?1763445949285888228?= 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 17:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 84366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2292799vqo; Mon, 17 Apr 2023 10:38:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Y4AeCyP545iIEQwIPmdx67naF2FVKuEcX0nGjhTpcTPx22aio5gwyTYXCm9b3IVkNpnmew X-Received: by 2002:a17:902:ec92:b0:19e:500b:517a with SMTP id x18-20020a170902ec9200b0019e500b517amr15078330plg.69.1681753113455; Mon, 17 Apr 2023 10:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681753113; cv=none; d=google.com; s=arc-20160816; b=iDyVBkQC5QeElchdjVde6sqZvy2lpKl43LZMHM/1mS0ZJ7+KKybezuOfX6QvqlAP3i JMJfAP5+5b/xMckZVLYSofKd6GX4b+3ie/ODXLRABmWhAxKpH0wSnsKno8WKCrWFplcw DKWLtLIw24zjr04MEyGcQJrCS0Ju26CrCY4rDozvqpWedylVW/d+ebRSeyYp0oL9Y6mI mfaDcWSiw8BvgnF3HhQEob5RZoEDiOp/lSd4yVY7KB0BvUz+79LrzKc8F+Ih8DQZipVn TBPghL5TWDmfbxIKhJhrA5yuhVjRfVi9DitfIsm8Ghcw7cZuQDwdHdkWEbD2GmV2EqF6 fIqA== 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=ac9HY+UwMkXIl4udhASlu1Iiq0Stde6nwToLb1PxMKM=; b=xSOdMHOnlIDbq4iqBsg09fTGtx6um+6ELhNnzDFNboTEjG2bH00v4UHS4aid1AQzBD X7rbZJ6PKkQcwPp88eH2W7y2WuKOw1QiP+nEK89Nc6MsqZMW5sRwXzhU3mGi9opeQbXn UgtpaSLij3WJf21ilctygJajtWHzYxveeC13H2eaEVOxCkVzGB+Fts7m9DJUQ3JIWtPa TMM3P440OkEyEy/BCZaQixDocF15v/Uq2yGonVIWMQnq3jizAywR8AG9VsxfIa/fvIvM OmwjAlokZPQ0/VxpF+7vxXEyIPLt/JRHL0f9wtbDb3qvDxNW1F6BL+qut+XYCOFXWncw xeaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CzjfofkQ; 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 d9-20020a170903230900b001a6d0a8c713si4108580plh.106.2023.04.17.10.38.20; Mon, 17 Apr 2023 10:38:33 -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=CzjfofkQ; 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 S230355AbjDQRcy (ORCPT + 99 others); Mon, 17 Apr 2023 13:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbjDQRct (ORCPT ); Mon, 17 Apr 2023 13:32:49 -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 ADDDDAF2C for ; Mon, 17 Apr 2023 10:32:48 -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 35CC56103E for ; Mon, 17 Apr 2023 17:32:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E55B4C433D2; Mon, 17 Apr 2023 17:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681752767; bh=HHLa39ETA/u3pWI5BL6sseaRF5jWhnYjA/pmy+XNmas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzjfofkQ+pPoF44cYauKQrtJKclwDdX4CpSvOCuVuJT+h12RpH2N42m6iz5Cq8D5Z 9p+gTbRcDwF4FSF4jSwBJwI7+2QS/nzO3nEXhVb6Thi3LlJku/EwgVcECSZuRe7Ddl NthKPqW80SkXjBNT2hXuLvUyA4mS+LgRC/MachFhcEgajUP0exf/X0+PwJ5V69sJrz sRYa7ngGRmX3N04NuLePX9INExZaGB++Z57ocFPrMZM4/yZIWfz029dGD7lVqwa+q4 ZftOqD4ytBsZcutFWN8cFSrp2Tn/FAOnrSHsdeyaLPPmLd1DAea9dfrfWCfhR2MUgg Z+FKOP2mO56BA== 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 v3 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 17:32:38 +0000 Message-Id: <20230417173238.22237-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230417173238.22237-1-sj@kernel.org> References: <20230417173238.22237-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?1763445952765105845?= X-GMAIL-MSGID: =?utf-8?q?1763445952765105845?= 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") has broken it up. 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();