From patchwork Mon Jul 17 18:01:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72505C0015E for ; Mon, 17 Jul 2023 18:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231251AbjGQSBS (ORCPT ); Mon, 17 Jul 2023 14:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbjGQSBO (ORCPT ); Mon, 17 Jul 2023 14:01:14 -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 905DB1BE; Mon, 17 Jul 2023 11:01:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01F90611D0; Mon, 17 Jul 2023 18:01:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F51CC43395; Mon, 17 Jul 2023 18:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689616872; bh=4H5bZcoG+0w9ieEzeSthnT4nJRX8tO6DLkfwj3Il66k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rtpKCZlN+OtkLZWQbdGg9iStTUBMHDho2PwBrOUbZSOew1cdg8FOlMwI0GwnMv+tS nnUt0ZsWRL5IT44W+fBP/BZ/ADUc357QMvZSIaidaBQTrSJjdvMz9sAODwhcQYIOHv D7e5e/tiNMmgsa6re/QAfAaxbR8HHYneBYbCjsI6Br4AKPCXEHg+3cWAplYD9rJ39M 8eXnV4hN5LBFzDTdmIV5EBUnN8CA+nodzVQJCs7spfpz/+z6gyPnxDz72Nic5SOutF U6x/zFnIBBk/aaKhZn4uO9SUHAy/c9J39JJv40P0p78cGAygMUV/Gl8PSL6tTiB8rs Ha4qMnoHLjPZQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DB19BCE0902; Mon, 17 Jul 2023 11:01:11 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, SeongJae Park , "Paul E . McKenney" Subject: [PATCH rcu 5/7] Docs/RCU/rculist_nulls: Specify type of the object in examples Date: Mon, 17 Jul 2023 11:01:08 -0700 Message-Id: <20230717180110.1097362-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: SeongJae Park The type of 'obj' in example code of rculist_nulls.rst is implicit. Provide the specific type of it before the example code. Suggested-by: Paul E. McKenney Link: https://lore.kernel.org/rcu/43943609-f80c-4b6a-9844-994eef800757@paulmck-laptop/ Signed-off-by: SeongJae Park Signed-off-by: Paul E. McKenney --- Documentation/RCU/rculist_nulls.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 4d6f077552ed..479cedfec446 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -18,7 +18,16 @@ to solve following problem. Without 'nulls', a typical RCU linked list managing objects which are allocated with SLAB_TYPESAFE_BY_RCU kmem_cache can use the following -algorithms: +algorithms. Following examples assume 'obj' is a pointer to such +objects, which is having below type. + +:: + + struct object { + struct hlist_node obj_node; + atomic_t refcnt; + unsigned int key; + }; 1) Lookup algorithm ------------------- @@ -144,6 +153,9 @@ the beginning. If the object was moved to the same chain, then the reader doesn't care: It might occasionally scan the list again without harm. +Note that using hlist_nulls means the type of 'obj_node' field of +'struct object' becomes 'struct hlist_nulls_node'. + 1) lookup algorithm -------------------