Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2026473ybl; Sat, 31 Aug 2019 06:42:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzztND4k6E6JODRKf08h/rqekZ7nwcxcYzKfk5m6SZFSWPrJWoMKkArMNn0k9X6X5VY//KN X-Received: by 2002:a62:86cf:: with SMTP id x198mr1370188pfd.234.1567258976991; Sat, 31 Aug 2019 06:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567258976; cv=none; d=google.com; s=arc-20160816; b=a055ZAgpc2iGIvftgL5V6hncflq0TPi/AM5AEt+UdLt3fm6opWdn0dgFVI3W4+VdXL WwlGx/jLpNFZcfH6U3GlAk30Xu5fq77En7iVRqOgpwN3XqJumi3GHbjx2YXOoA2aPt36 F1bf0XCiAM5+W96rP5FasdBF6joUu2ediBGhxVPvPcHSnLTmkrWsy/MamDo7S4FCs6Ad 4+TcHCxBVXpYvlxvxQXzUkfkIHJW9Pl90+vr6EXJbkxHKTcvSha13v3Ra6k0c+1DbsHp kxBKt6FRmc2tWuDwZ26awFWBsSZfY42ICsIIE1ZKEppK4duG5BI2qEwpj8eTimpkOJs0 878w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RVPkgbu0sxV6mcZJE0jOj7nmkVC+BNiaQ+8xHqgLNmM=; b=nuxZGpYBnZNPM7PsQ+Yllni5nQM4emDk0d4wUQILJ1jGsUPpN/sd6Zo94LkzSFUS6P q0zaZrma24StpShXFtDhkDwaEXIG9LtT4DNMxuonrgfmTUaJ0SrfSrwzr0NYi/1iB2Yi kFC81yDW+DtKRYaZoC9S6HC7mL073eSZDQjIS3rt3LAtxZLmqzBXNbMdsYewiK3u8+BK nsYBht67IANXzYZRVgEfUoY7I/dxLDuAegxkxxaJZksjfldkLZ7Vjd30wOMdb4xRZGxk IQ7HZSoEh9zX7Gd2AqNK3DWg4TGXnCVVHzVKXwz9SZFqyKn2Zqy7TsyHmIJl1HzKwbRE B6Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kolabnow.com header.s=dkim20160331 header.b="YJlXYID/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f37si6953549pgm.145.2019.08.31.06.42.41; Sat, 31 Aug 2019 06:42:56 -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=@kolabnow.com header.s=dkim20160331 header.b="YJlXYID/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727915AbfHaNlu (ORCPT + 99 others); Sat, 31 Aug 2019 09:41:50 -0400 Received: from mx.kolabnow.com ([95.128.36.42]:11244 "EHLO mx.kolabnow.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbfHaNlu (ORCPT ); Sat, 31 Aug 2019 09:41:50 -0400 Received: from localhost (unknown [127.0.0.1]) by ext-mx-out003.mykolab.com (Postfix) with ESMTP id 7D537403FB; Sat, 31 Aug 2019 15:41:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:message-id:date:date :subject:subject:from:from:received:received:received; s= dkim20160331; t=1567258905; x=1569073306; bh=RVPkgbu0sxV6mcZJE0j Oj7nmkVC+BNiaQ+8xHqgLNmM=; b=YJlXYID/w1UXyY4/Qpx9k/1UH1lvxS27JKB 72vjWrrJbs+ltJOrFmL7hPz6FU+gG91pIGJlbsMmd4tHvmtvJeVg9CnFF0d5Iwep CYU1Ly40rHajx0W//Icob0D2hWH7kZgysrumuKMuT7vBZ9+ead5hUoG9mAYzufKK zN4Ac75vUNzqI+Nz7/QRz/7MqW87WxogUZeDC6TqpRmIcRPDN+r9hwblkFYa2gfA PxKTbRP2qeaWKUMHWPHk/IPf+cfxdifpZGDZpiBIoHAc358bxBX3xmi/X5lSOq95 0CcJF+86AKuq5g52XXGGMGwYvQfT706R1RwxGhW7jaUJibSfI2jz6nD4xxzKM9GE mNZ+VxMasTVtwceyERpCujlUGJBdng+VG6AYwFBXWQe0KEUkRk1YQjmPRO2jm/LG v5+9p6ufhuYzyVTAjPgS3EEKH/qMkwTq+2aemMpxFq7PCqx3Hw5w1bETuIeil4Ev Cp4snbhf6LKjly2/AgK0rrfsCulrqyx59uX6+jiB9UADZJKFYBTAgxc1xBfVrC5B lBdcEjsVve7wnhCWutZcVeMVasqh3gckFqThHpTGy69lbdZpF27NiPxBjjbmzyfU B18phR57oiVK+UHsUltHnCsFbTi5er/SB7j+xylhGlguW5bu7OzAOEpugWWDIXZQ Yo59BX4U= X-Virus-Scanned: amavisd-new at mykolab.com X-Spam-Flag: NO X-Spam-Score: -1.899 X-Spam-Level: X-Spam-Status: No, score=-1.899 tagged_above=-10 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out003.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qoz9PPGpPg2l; Sat, 31 Aug 2019 15:41:45 +0200 (CEST) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by ext-mx-out003.mykolab.com (Postfix) with ESMTPS id BBA42403EB; Sat, 31 Aug 2019 15:41:45 +0200 (CEST) Received: from ext-subm003.mykolab.com (unknown [10.9.6.3]) by int-mx001.mykolab.com (Postfix) with ESMTPS id 3591A246A; Sat, 31 Aug 2019 15:41:45 +0200 (CEST) From: Federico Vaga To: Jonathan Corbet Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Federico Vaga Subject: [PATCH] doc:lock: remove reference to clever use of read-write lock Date: Sat, 31 Aug 2019 15:41:16 +0200 Message-Id: <20190831134116.25417-1-federico.vaga@vaga.pv.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the clever example about read-write lock because these type of lock is not reccomended anymore (according to the very same document). So there is no reason to teach cleaver things that people should not do. (and by the way there was a little typo) Signed-off-by: Federico Vaga --- Documentation/locking/spinlocks.rst | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Documentation/locking/spinlocks.rst b/Documentation/locking/spinlocks.rst index e93ec6645238..8053fd4c3544 100644 --- a/Documentation/locking/spinlocks.rst +++ b/Documentation/locking/spinlocks.rst @@ -106,7 +106,7 @@ and on other architectures it can be worse). If you have a case where you have to protect a data structure across several CPU's and you want to use spinlocks you can potentially use -cheaper versions of the spinlocks. IFF you know that the spinlocks are +cheaper versions of the spinlocks. If you know that the spinlocks are never used in interrupt handlers, you can use the non-irq versions:: spin_lock(&lock); @@ -139,18 +139,6 @@ on other CPU's, because an interrupt on another CPU doesn't interrupt the CPU that holds the lock, so the lock-holder can continue and eventually releases the lock). -Note that you can be clever with read-write locks and interrupts. For -example, if you know that the interrupt only ever gets a read-lock, then -you can use a non-irq version of read locks everywhere - because they -don't block on each other (and thus there is no dead-lock wrt interrupts. -But when you do the write-lock, you have to use the irq-safe version. - -For an example of being clever with rw-locks, see the "waitqueue_lock" -handling in kernel/sched/core.c - nothing ever _changes_ a wait-queue from -within an interrupt, they only read the queue in order to know whom to -wake up. So read-locks are safe (which is good: they are very common -indeed), while write-locks need to protect themselves against interrupts. - Linus ---- -- 2.21.0