Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2529744rbb; Wed, 28 Feb 2024 05:01:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjx+8NLHtWstco8XM5fdkINCe2Ld6HzIPsEBq1dStwZh37dGiVWt6jQ8R4XbwaC3SWQJXwdQmdx6EIxb9lRLcaDlSCj1xdQFmiW3Rg7Q== X-Google-Smtp-Source: AGHT+IGtwbMO2UFE1LfA/ZuCYxz3jJuz4BUTc01BO0I1gvICkCiHDpK2f6rE6xRudj55fYRCZEyv X-Received: by 2002:a05:6820:2812:b0:5a0:573f:9b22 with SMTP id dm18-20020a056820281200b005a0573f9b22mr11252186oob.7.1709125261364; Wed, 28 Feb 2024 05:01:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709125261; cv=pass; d=google.com; s=arc-20160816; b=kMmEtHYMUpv1xj6NkDl7po+yyr1eCF+2g8qWrVZPIrnxjNC1RjjujI5JlnAZM1nW4P sqUfrdbDvLW8sS0voGDbHSbZ6+U5w4nJ8/4i+Cwl3od7VTs0VYmze5EOdbrjAzvLAyt+ AvAZO1PiQiRycSnoiVpJ4FvXVO1tq/QLvBea8jHxxlYmJUgRugfYhL3NfVHy8LY3aKkb 3IY9KQvqX7Wk7WaaQNgIN6fM5JqbxF0p/4CxfHVoN36bxRa8JeJtH1t70toPT8hcAHSd UEAjqWDEv1NtqpcZblVjdrOzuADD+mhd3vexE+84zmWAzxZI8c+aOfNHP7r8o381bm+k xQDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=IGMCpIi1CngzONyyqp5nSMzJJWqhw0WiBeW2EkwS0Rc=; fh=Lf2ys8B8adCSgbeQ6sCsOsgkPFRdsgLwbTH2Fa2dGSU=; b=ngqSW1sEwjckk0ZHV3g8SE2ZzwmKJItg8/9x0rW0uhasl5kDWGeNa1Z9Z1DzaC7rYk qHXOwz8W1e9WTAm+y/nBLypeGfKOLlHB6tr3IXJQktJr4PiKv9cuOc4GEEW59NHeY2oK wd+3yQ/rE0bCMtqm0UYq8wSUVLmiOx0k50W0TS8x0FLUYKPaJVpCNS+3VzNF474q2RMK N6tslPtIjTzEEZYWWnE1b22U3xEBUFqqb8arY8TYegPfF5xUUHGjU7VDwIFC6vAGVgBm t6uK8gztjie64lKELWxnns7c89CX0VaU2q5rNc9Mmm43JkaH2cawqyQr9zH3AaedCIRM q2XQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0llgFHOV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-85040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y31-20020a056a001c9f00b006e4ecc281adsi7537890pfw.105.2024.02.28.05.01.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:01:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0llgFHOV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-85040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 49D97B21F3B for ; Wed, 28 Feb 2024 12:53:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B9DA14AD28; Wed, 28 Feb 2024 12:53:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0llgFHOV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="HrzdkMJ2" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C34AC1487D7; Wed, 28 Feb 2024 12:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709124806; cv=none; b=WeeTgnT0MAiNxur6+bHv1Xcd+Vq+Se1pCvNDMDDy+wfTWpQveYonqIn5OSjtjldRLHlNzUtYKmYP+WqAW4wKkN2LZ2NpZqe4Htw+//gtBg12v3YCpo34/cCZF6TaRY1HhgYB+/9goDeO1Bpd45x2VwesplBw81ndxwNM3SwvQb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709124806; c=relaxed/simple; bh=qllb9BunC54GClJH3gNc/f+b7ajqvH2CC3VhxcSMK7U=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=JTjQhidr8Zw0CCs07SxxeVdpFOW1wQBxtIXKfbKOsLvbe2HGP7TWGRjgiDV7BZI9dlMAdfjZJhMfEYxchhs7IaCORIv+XJuRIDVCnJuUZV1qUlPVd1z2yWW4SuhdhJDA1Tb+5fhWY25WjcQ7jKlQMbnYMRmkNRAuXAWoUimrJ/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0llgFHOV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=HrzdkMJ2; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 28 Feb 2024 12:53:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709124802; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGMCpIi1CngzONyyqp5nSMzJJWqhw0WiBeW2EkwS0Rc=; b=0llgFHOVBDZse+shVKjZSSREH5DX+LW+nrjz7Al1K6aW1egTf7npBRtb4fxn1hKUJ001a4 yQr0NWSbADnPk2fZuBiGjm9NP5RjC8yx3Rx4DILQaFJnpu1bXRUYRU6/r2IV1c4hrSMpNq II5t+66AGzXLWFyxqgHz7zI6oorOGVKMH4GBDRETxSlLhw50eNOp7Ai9yppyC+E6PbzGxs XAMdR1vVuZp4k3ARWQa0znFoBV8TCzW7waBQ2Vk77vGe4SUf+jQ4BIf8j/U3+4xOvGcR8V iVBR/0S4DUgctY3H1b1+mY9eB4zj73492OStCff9u6GWMPCnyGAICZLybT7o7w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709124802; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGMCpIi1CngzONyyqp5nSMzJJWqhw0WiBeW2EkwS0Rc=; b=HrzdkMJ2+ipuguPz8CPi0/I1ewUzeKhkHpaNp9GP5qpqXJw3lidi7UCEG45fZwmD82pmav S/nqWoHmHvoU6zBg== From: "tip-bot2 for Waiman Long" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/rwsem: Clarify that RWSEM_READER_OWNED is just a hint Cc: Waiman Long , Ingo Molnar , Boqun Feng , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240222150540.79981-4-longman@redhat.com> References: <20240222150540.79981-4-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170912480198.398.8722869596829490134.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the locking/core branch of tip: Commit-ID: d566c78659eccf085f905fd266fc461de92eaa8f Gitweb: https://git.kernel.org/tip/d566c78659eccf085f905fd266fc461de92eaa8f Author: Waiman Long AuthorDate: Thu, 22 Feb 2024 10:05:39 -05:00 Committer: Ingo Molnar CommitterDate: Wed, 28 Feb 2024 13:08:38 +01:00 locking/rwsem: Clarify that RWSEM_READER_OWNED is just a hint Clarify in the comments that the RWSEM_READER_OWNED bit in the owner field is just a hint, not an authoritative state of the rwsem. Signed-off-by: Waiman Long Signed-off-by: Ingo Molnar Reviewed-by: Boqun Feng Link: https://lore.kernel.org/r/20240222150540.79981-4-longman@redhat.com --- kernel/locking/rwsem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index 2340b6d..c6d17ae 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -35,7 +35,7 @@ /* * The least significant 2 bits of the owner value has the following * meanings when set. - * - Bit 0: RWSEM_READER_OWNED - The rwsem is owned by readers + * - Bit 0: RWSEM_READER_OWNED - rwsem may be owned by readers (just a hint) * - Bit 1: RWSEM_NONSPINNABLE - Cannot spin on a reader-owned lock * * When the rwsem is reader-owned and a spinning writer has timed out, @@ -1002,8 +1002,8 @@ rwsem_down_read_slowpath(struct rw_semaphore *sem, long count, unsigned int stat /* * To prevent a constant stream of readers from starving a sleeping - * waiter, don't attempt optimistic lock stealing if the lock is - * currently owned by readers. + * writer, don't attempt optimistic lock stealing if the lock is + * very likely owned by readers. */ if ((atomic_long_read(&sem->owner) & RWSEM_READER_OWNED) && (rcnt > 1) && !(count & RWSEM_WRITER_LOCKED))