Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4303010rwe; Mon, 17 Apr 2023 10:34:53 -0700 (PDT) X-Google-Smtp-Source: AKy350bhTcQZbs+vTotD47RHutmHrX7kJjQDzlKQt9HrhgNmeqZfmIx+IW/FGTAcpO1WygE4u02i X-Received: by 2002:a17:902:d482:b0:1a0:4ebd:15d5 with SMTP id c2-20020a170902d48200b001a04ebd15d5mr15111000plg.67.1681752893493; Mon, 17 Apr 2023 10:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681752893; cv=none; d=google.com; s=arc-20160816; b=RfSYB7hYJ0fB/MdmSk0mmOCae89hyYZUxjyxo8pZlCUov3quT2DF/Qzk9OazdTyAv0 dwVxiUPj9RigR3YcxubjVTxrqBwXdoLutS28mPNbTfZHQu6QEggR+1obu8a4gplcJwfB u2zIs91wA14U3MTFNmzqaaED4UsUGaJKG3Bd+OnNhftQha3aaNMUqg9qDQvwCzu/9Ez3 97wSDT8GEpupg8KiYoLp7eLx9YgpRXoQwRy5NVjlSiKLRa3L7aYABicHKXiRi4NMue0o dJ+HhzNFaDbylQ877Jza9taHO7yqc/w9EuKDID2JNmcowIoiCrkEdmX/IMlN6u7nwMr+ UCVQ== 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=W092TRYZoG2Kmd7EAoicpoMEG8LaPYWUcJrJz/54fCc=; b=T8LfK/kXL+REfhTMDrW7j3rSRS+yDKB9hKM7+Z0Zh31hdmABGKacrZf9W9wZFWrF3W dVhuQpD791sJEeohD8OMcwkz/bgeNCpiIPs5IJoARQnB1UgbMY7+OAmGYopGT0LnM4VY KDnbGNvUQArsF1JNdMUuFHPFvQ+GHp07bkOxrsCgMp4BSxQtgglqg3KtUZNlwrur+rbR Tv7zt5n0neVzndayOvlaLVdKxz/TF4t29lQvnYKbqESXMH7+8Zo5GloAaFifJqXN0xMz k1an4sY31GeAlcYMWkxEz2s2+QBDZK4QVKJut4TtjIHjqx48+f9Vy669j3XSxPNjs3xs PiAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nBxoJpT0; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a17090332d000b001a6a4f3a16csi6552275plr.588.2023.04.17.10.34.38; Mon, 17 Apr 2023 10:34:53 -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=nBxoJpT0; 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 S230137AbjDQR1D (ORCPT + 99 others); Mon, 17 Apr 2023 13:27:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbjDQR1C (ORCPT ); Mon, 17 Apr 2023 13:27:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD7F44B0 for ; Mon, 17 Apr 2023 10:27:01 -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 BE51661169 for ; Mon, 17 Apr 2023 17:27:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 407CAC433EF; Mon, 17 Apr 2023 17:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681752419; bh=vEWkokyirFhRtj/YWmCPS6fJqqBTAPVAZdVM7XsRP/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBxoJpT0UWy+yulrd7i+AZtLb5bXUGAskJS7oq6+UWBmmMZ877YDw4x+r9MwtZmyI 0j1Hvv/qv3Orw3IyN6R7EvroVejgIuOAoVHRNOqZMDL+hpXKFstPU47B0+7pK7WKDx AOQ1LL/ao2tlosTkutFq/WvFZxxC53zIy2FSdywpfxTVjfKc4v+7fqWBjWaop2aIgH TWVrMII8IuJBi/U8+uU++ECPHN9lU+QVS3q048J8xcmsS/jmA0k2YpXElKyy8+EplF flqXtop7yryfuXpm7OwOFWaWKMf7nl8RIUchQDbSW6k9Qd3znSMemRXYN9Bqnw9B1g m5LA6PpkNePuA== From: SeongJae Park To: Vlastimil Babka Cc: SeongJae Park , akpm@linux-foundation.org, willy@infradead.org, paulmck@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code Date: Mon, 17 Apr 2023 17:26:57 +0000 Message-Id: <20230417172657.21925-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi Vlastimil, On Mon, 17 Apr 2023 13:05:40 +0200 Vlastimil Babka wrote: > On 4/15/23 05:31, SeongJae Park wrote: > > The SLAB_TYPESAFE_BY_RCU example code snippet is having not tiny RCU > > Since "tiny RCU" means something quite specific in the RCU world, it can be > confusing to read it in this sense. We could say e.g. "... snippet uses a > single RCU read-side critical section for retries"? Looks much better, thank you for this suggestion! > > > 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. > > "has broken it" has quite different meaning than "has broken it up" :) I > guess we could just add the "up", unless someone has an even better wording. Good point, thank you for your suggestion! I will apply above suggestion on the next spin. Thanks, SJ > > > 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(); >