Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3817021ybg; Mon, 28 Oct 2019 20:13:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy94NSbO3S8UtTB6Lp3ucRueNWPUJ35bxwhRuO4q8SfLerU2U4rriC7fV8Jq89U13402ZKM X-Received: by 2002:aa7:df85:: with SMTP id b5mr23194629edy.298.1572318817654; Mon, 28 Oct 2019 20:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572318817; cv=none; d=google.com; s=arc-20160816; b=YD5ixUYwlp5zKbLsYFktfazNOKb8a/FuhyWms6DFrR0DYOzbzqni2dP3Rn6iqkWc31 XqLxCOb0N9ylqQVPF/7buckFrm2oozeNBu9KgLMmJMmCcuya+/fW/5wnypc86F2jFCdo eFzCynJ0fUFqGj0dipL6vG+gTlz7p0PAzaESL+6Tp/N7o+SI8HoWXtbmWRhkoyZeiW5+ dH8OUk5O/0HIsvb9zeQs2xiusv1mVCZC5zbsFIxySuueFR2bs3vDWPfO4vqOAD7erZVx WKuag/tPar/S088oj6UQ1pydd6GmbqsJLp4MTbpfuweKVCno8qyfHBIivttNpUyuUu30 y5Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Y5HapZnby+jyqPlPKCmmD1uZdwYPEqf/I0zhoDbSqdE=; b=qSfR09TIcJIoXnls4Punko89B2tOBDauC4jGKI5HP4uoqbp/7Xf5NSQi3j1rv1l6c4 WZOoQE2flTBC8Z7KxjffN/qgsUqJT2Cp0Xg5TsRFRz//0aYlAe41A5n6ApXOAv8gQwmx GvpmdOGbQ+XkbkG+sLwXsCxMXiDQNCdGclMBSHDTpMWdk+O47zH3jrNTXDenAHLi9YHG oz4/nrvwDfEZzfKBr9jmqB83YiZKQIh1tXnrT2UbjaEk5trmkMeP2I9J43CLqpuIRanZ uLl0kGyULOs6zxhK4aYYGeomeEiSoO1JOVvlJNqEFE9sq19Oyk/uSY5+7docCSzzMrxs WaXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pit86DQr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si4063552ejm.165.2019.10.28.20.13.13; Mon, 28 Oct 2019 20:13:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pit86DQr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390709AbfJ1PTz (ORCPT + 99 others); Mon, 28 Oct 2019 11:19:55 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45661 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730149AbfJ1PTz (ORCPT ); Mon, 28 Oct 2019 11:19:55 -0400 Received: by mail-pl1-f196.google.com with SMTP id y24so5711223plr.12; Mon, 28 Oct 2019 08:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Y5HapZnby+jyqPlPKCmmD1uZdwYPEqf/I0zhoDbSqdE=; b=pit86DQrHLHcPW+IaWOpF5Q1YGkUJQQofm3PHHK+/6cozH3AGBQ9dBZg75b60WxPQV AEcZ95OpnuuwG09kNyzgVsDppHsDIpGsBg3yCHeGQ7nnToDdma6IMRv7fOPpCC26qOFz DGgbbD/83h/RndSa/xKKwKyQ2OVNQsKOeW+GIOL4YF7mrH1R0xYL+WUJhnwZhnlON0YY a9yyjvAyQW4nuWxB9cGW4keFDDfRMd+LlboAhXNTUiOs+94CTCT/I4imahM2xOl38o4b q/vmhor4lfPdU4ImyUf7Od58aQHgII5AKZyIP6FTisKY//sURPzLIqkVTpQHg/ivgUaU R0cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Y5HapZnby+jyqPlPKCmmD1uZdwYPEqf/I0zhoDbSqdE=; b=JEE1Vaf9jNBNWvOuVTKIhOUZ0gpmIe2c8b/dk1MfFN0jislc87Sf4JDmouXpi8Vw/p Jo7vJvWvmxuodXpxIjPFaKTN6EZOClR1ywkGnZxwpYHrK2KTTVTbCrTEPXQmPSNnmJRG Za8iqlpkyPqMRu91CiZHRYLAG86sLa3lAIr4Xe03dYrQNL3dTL8nWJEeZYYQS03LRG2z Rl5WKoP5DgozgGx0TBF6fCAWdp1Bhd1dBKHMV4EzVaoZqv8uVSU8/kSLeO9p/QsNQrTv 7lKTyVPK7y5XCGxrsEWGnv45UGjssVe2lR9xdDqNDt9fX8MCzAmAU1KMnUnNcaak/nhO Dmqw== X-Gm-Message-State: APjAAAUPxo7F3QHh6ZRxSgOA3CSVxIZiAZFAgMF7nqHGyQIn0pxf3wZT S5rveogxxA3E89PxDULfCW5gvk7L X-Received: by 2002:a17:902:b116:: with SMTP id q22mr19353634plr.201.1572275992639; Mon, 28 Oct 2019 08:19:52 -0700 (PDT) Received: from madhuparna-HP-Notebook.nitk.ac.in ([2402:3a80:51e:687:393e:2dcf:24de:b4fb]) by smtp.gmail.com with ESMTPSA id v3sm2786467pfn.171.2019.10.28.08.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 08:19:52 -0700 (PDT) From: madhuparnabhowmik04@gmail.com To: paulmck@kernel.org, joel@joelfernandes.org, corbet@lwn.net Cc: linux-doc@vger.kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Madhuparna Bhowmik , Madhuparna Bhowmik Subject: [PATCH 2/2] Documentation: RCU: Converted arrayRCU.txt to arrayRCU.rst. Date: Mon, 28 Oct 2019 20:49:36 +0530 Message-Id: <20191028151936.27016-1-madhuparnabhowmik04@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Madhuparna Bhowmik This patch converts arrayRCU from txt to rst format. arrayRCU.rst is also added in the index.rst file. Signed-off-by: Madhuparna Bhowmik Signed-off-by: Madhuparna Bhowmik --- .../RCU/{arrayRCU.txt => arrayRCU.rst} | 18 ++++++++++++++---- Documentation/RCU/index.rst | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) rename Documentation/RCU/{arrayRCU.txt => arrayRCU.rst} (91%) diff --git a/Documentation/RCU/arrayRCU.txt b/Documentation/RCU/arrayRCU.rst similarity index 91% rename from Documentation/RCU/arrayRCU.txt rename to Documentation/RCU/arrayRCU.rst index f05a9afb2c39..c8a26f7b2577 100644 --- a/Documentation/RCU/arrayRCU.txt +++ b/Documentation/RCU/arrayRCU.rst @@ -1,4 +1,7 @@ +.. _array_rcu_doc: + Using RCU to Protect Read-Mostly Arrays +======================================= Although RCU is more commonly used to protect linked lists, it can @@ -26,6 +29,7 @@ described in the following sections. Situation 1: Hash Tables +------------------------ Hash tables are often implemented as an array, where each array entry has a linked-list hash chain. Each hash chain can be protected by RCU @@ -34,6 +38,7 @@ to other array-of-list situations, such as radix trees. Situation 2: Static Arrays +-------------------------- Static arrays, where the data (rather than a pointer to the data) is located in each array element, and where the array is never resized, @@ -41,11 +46,14 @@ have not been used with RCU. Rik van Riel recommends using seqlock in this situation, which would also have minimal read-side overhead as long as updates are rare. -Quick Quiz: Why is it so important that updates be rare when - using seqlock? +Quick Quiz: + Why is it so important that updates be rare when using seqlock? + +:ref:`Answer to Quick Quiz ` Situation 3: Resizeable Arrays +------------------------------ Use of RCU for resizeable arrays is demonstrated by the grow_ary() function formerly used by the System V IPC code. The array is used @@ -60,7 +68,7 @@ the remainder of the new, updates the ids->entries pointer to point to the new array, and invokes ipc_rcu_putref() to free up the old array. Note that rcu_assign_pointer() is used to update the ids->entries pointer, which includes any memory barriers required on whatever architecture -you are running on. +you are running on.:: static int grow_ary(struct ipc_ids* ids, int newsize) { @@ -112,7 +120,7 @@ a simple check suffices. The pointer to the structure corresponding to the desired IPC object is placed in "out", with NULL indicating a non-existent entry. After acquiring "out->lock", the "out->deleted" flag indicates whether the IPC object is in the process of being -deleted, and, if not, the pointer is returned. +deleted, and, if not, the pointer is returned.:: struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id) { @@ -144,8 +152,10 @@ deleted, and, if not, the pointer is returned. return out; } +.. _answer_quick_quiz_seqlock: Answer to Quick Quiz: + Why is it so important that updates be rare when using seqlock? The reason that it is important that updates be rare when using seqlock is that frequent updates can livelock readers. diff --git a/Documentation/RCU/index.rst b/Documentation/RCU/index.rst index 340a9725676c..c4586602e7e2 100644 --- a/Documentation/RCU/index.rst +++ b/Documentation/RCU/index.rst @@ -7,6 +7,7 @@ RCU concepts .. toctree:: :maxdepth: 1 + arrayRCU rcu listRCU UP -- 2.17.1