Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp571477pxb; Tue, 19 Oct 2021 08:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg/Q+ROz7zOABsf977u2VImc4ocmiRuKalYUaitNhjV0Nwt7Mg/zjEVazbubDg3en7x6ao X-Received: by 2002:a17:902:d488:b0:13f:165e:f491 with SMTP id c8-20020a170902d48800b0013f165ef491mr34313400plg.12.1634657816237; Tue, 19 Oct 2021 08:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634657816; cv=none; d=google.com; s=arc-20160816; b=gplSfWcqM4ifaCSUzLDodg0hR+zF0eTHXSK1ax1cblmWv19EJHFtRlbUSflZzQV6BD +gVTyeAf5MX2s1WrZyXRfYWrd4RyrTRDo0oHyFhiESHA+6bYYtMXUoXKo8NBVaofYqZW E2C243p2wc55ezoolvdIiD0B6eHqQkHcBzsaluHWKJ+FzG6mWh7k0MCK3GAHKnWjtfF/ DpDJ94laduf8isXUwqu5xNxfpsFR2SZAHAGGWmdgnHSvZcw5hT2Vh7FsN44MQNImpXdW 6ag/linfunN6f4UoRt0nz/JMYkXwSTKGlfcroSAal6aW8Ad62SoREJfcLQvhPXlVCqYe hsXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=WJ2h9hd3Fu6v6Na8a7vKsei1q56OAd6Vc7H98oZ9jDg=; b=o1Fhu/qPOKuR9mlUjRTAN/5o36/6oXwaLFVFDlTj6rZ/Nx75I789ZEPBSBWUVWZSkD S69teZwbeM5MQEUAmbU5DIgoKavqYZ877y1mpXJm5BnnnwGkYh/zudO8AS788vffCMsz pKioa4Jjy4o1CJUqivZY+J26RtuV9vLSyCZljcwVtZpprKsFFJFxzZxvaTJI+kMG/Z4s MsXrpFQLo7NuxPk9s23YTJavd9tkn48evwHrwdEyMhbkVDf/Ei9Xt6DmsUTrSSmDy/Cw vNC6XAyIscppo8YMBb+xvitS0tB9mgnMnsO1CFa2hRH/Zd8yCiV9jOPTpJFK3uzJZQAR JDKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=X7IfOLU2; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w70si10465989pgd.559.2021.10.19.08.36.43; Tue, 19 Oct 2021 08:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=X7IfOLU2; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbhJSPhw (ORCPT + 99 others); Tue, 19 Oct 2021 11:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231379AbhJSPhu (ORCPT ); Tue, 19 Oct 2021 11:37:50 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCB4BC061746; Tue, 19 Oct 2021 08:35:37 -0700 (PDT) Date: Tue, 19 Oct 2021 15:35:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634657736; 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=WJ2h9hd3Fu6v6Na8a7vKsei1q56OAd6Vc7H98oZ9jDg=; b=X7IfOLU26Mm1WuEGlFlH5jcSPpyEjx3HnHzcUdv63rc7AppIlL0xymp35hdI+9KDWpQ5pr eztAaheVAVUx5xpqQcavi++ecS74eGsJFhF1MNgLq+scxjuDmJz8y1S6EVcR59P6hJ1pra N4xZmi9qzzUGYy4ftrWOK+g0QETQOaRDvAKjOLLpaYt16o9W/hkKmgmdsJLNdWunqxRDYY ttz9Q1qXk25AizEs3TnsIkE1jLcuxju53zHidsF/N5AocMo1PVLLqu7BXnpTH1InxcUkvJ DeWsbnPn92Dl1X6f6Q9BIJ5Z5M4icjilT/TuCet/b7/atuUKUyIB1a9YQqZJJQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634657736; 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=WJ2h9hd3Fu6v6Na8a7vKsei1q56OAd6Vc7H98oZ9jDg=; b=TDL3AWt3+n/NmMAyf/OwESAAW8HRtJs4+AYbd11XvlhaSP/oHsuS+jyI8bjCJUWqoGTom8 VQVvNwp5yOy3rtBQ== From: "tip-bot2 for Yanfei Xu" 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: Fix comments about reader optimistic lock stealing conditions Cc: Yanfei Xu , "Peter Zijlstra (Intel)" , Waiman Long , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20211013134154.1085649-4-yanfei.xu@windriver.com> References: <20211013134154.1085649-4-yanfei.xu@windriver.com> MIME-Version: 1.0 Message-ID: <163465773536.25758.8800618521559459734.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 5197fcd09ab6dcc4df79edec7e8e27575276374c Gitweb: https://git.kernel.org/tip/5197fcd09ab6dcc4df79edec7e8e27575276374c Author: Yanfei Xu AuthorDate: Wed, 13 Oct 2021 21:41:54 +08:00 Committer: Peter Zijlstra CommitterDate: Tue, 19 Oct 2021 17:27:06 +02:00 locking/rwsem: Fix comments about reader optimistic lock stealing conditions After the commit 617f3ef95177 ("locking/rwsem: Remove reader optimistic spinning"), reader doesn't support optimistic spinning anymore, there is no need meet the condition which OSQ is empty. BTW, add an unlikely() for the max reader wakeup check in the loop. Signed-off-by: Yanfei Xu Signed-off-by: Peter Zijlstra (Intel) Acked-by: Waiman Long Link: https://lore.kernel.org/r/20211013134154.1085649-4-yanfei.xu@windriver.com --- kernel/locking/rwsem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index 884aa08..c51387a 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -56,7 +56,6 @@ * * A fast path reader optimistic lock stealing is supported when the rwsem * is previously owned by a writer and the following conditions are met: - * - OSQ is empty * - rwsem is not currently writer owned * - the handoff isn't set. */ @@ -485,7 +484,7 @@ static void rwsem_mark_wake(struct rw_semaphore *sem, /* * Limit # of readers that can be woken up per wakeup call. */ - if (woken >= MAX_READERS_WAKEUP) + if (unlikely(woken >= MAX_READERS_WAKEUP)) break; }