Message ID | 167952396475.5837.11598351113694705444.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2604733wrt; Wed, 22 Mar 2023 15:31:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZYgrDIyQ55L5yOT0cvM/PrDmn8F6LeD20Vf7luXVLbacOBysEMHcHRDIgMhscI+IwwYCaV X-Received: by 2002:a17:902:e5c9:b0:19a:7217:32a9 with SMTP id u9-20020a170902e5c900b0019a721732a9mr3921214plf.26.1679524299075; Wed, 22 Mar 2023 15:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679524299; cv=none; d=google.com; s=arc-20160816; b=AFOh3qQXADRWTNqOzaByw7UzESkUM7Drf08SYbSjC+BrDB0MU4qSSpUCy92yREkAl9 0PlPlfjj3HZVTYlMMYSEFD0/i0YiGHyYvBTk/3ywu1gtZaRxPH4PRXki5kcgJIazMXmc RPFJM2VQwaf7J60Wnr36hbRJylZII47Ky3FyVFhA+JqODtO0apJyIYXjOSFb9rp4K1kM zPDWSSwZa+ecishSmaphKZZAXEJeNGRFs5nZxu7EW+mJ7lNULTy431WWoOlxkgQhniP2 tZDNMLcpL+aXF5EqXa1y64aSbM423PPPhc36WsjlLyAVYJHVmRi6KgHhn/5EeGUazvA5 OmYw== 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=Lonwx3OOvND6DSGV5w4ARUSC+QoyLxxKYdl6wMg0BrA=; b=JjpdSyp9ZS4uSsVgFpW0uommdunATv/iZH43DjfUoICGNLtyqebXCEk0LR3IlF3elP znE0WE2vp8KrmNtvWrTj1SPAs+LE0x0zSr6KFI0HW4JdwHenXF5pXvj33pnocsf9p+9+ i2JJxSNzHK3a6orNG8HpN3rMOzw+tKVjh4Onyfg3DRHsUHjcf7olkk9qrCVUJk3/ium8 t+a6l1OuMpADcBr9cTJZ/ZkJpSFk/X5yvxY88Wihn+057g/MajPy09X5MOkmhC88BeLC 4VZdnbojquSUdnv+Otcho9mqtOnGLZkdsIuGAqDUm8CYSlni4x+ImgwafijrYZo/vPDR AUtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DQIPeMyz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a170902d49100b0019af153b740si17422719plg.625.2023.03.22.15.31.17; Wed, 22 Mar 2023 15:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DQIPeMyz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229496AbjCVW0M (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Wed, 22 Mar 2023 18:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjCVW0K (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Mar 2023 18:26:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2201D23A75; Wed, 22 Mar 2023 15:26:07 -0700 (PDT) Date: Wed, 22 Mar 2023 22:26:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679523965; 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=Lonwx3OOvND6DSGV5w4ARUSC+QoyLxxKYdl6wMg0BrA=; b=DQIPeMyzjf47/vwhpwavHxHkar0zLrxOFRMKGJPOEwFhDeNruyVGMYjYd4nnPUXfzYnjz3 DTPLJ3vzx9AvtSSSDo6m4BJZLKzOQod745fmMhuNd9MyBaZfm1VgecwHmY2+uNqDDdLyWm IaMEcD8DJktVBSs9vIajnhiEGi10ajtMkSjSdmpoyh8zaYCqJGhTt1rk9n+UFq4pUbQYaf kvL7yBtYmtN+t/MW7ioeUMkwDwkLGeUNlFDKxfRUaKB/QArMl6vtdhGRpnhhSkZfhq8EnL BZXQUOnN4PuRXLVJewMLTjGMgly7lvmx74seC4uh9AoJeSpptHbVuPA8bT96eQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679523965; 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=Lonwx3OOvND6DSGV5w4ARUSC+QoyLxxKYdl6wMg0BrA=; b=m1uMKNTln/b70+QVaOSRsOkfwH7aZZfkzfGaET+sCGniCdXDicZJ0iYhTD3IFB+Fwkori6 aFoNq8VE0x1YbdAw== From: "tip-bot2 for Sebastian Andrzej Siewior" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/rwbase: Mitigate indefinite writer starvation. Cc: Mel Gorman <mgorman@techsingularity.net>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Thomas Gleixner <tglx@linutronix.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <877cwbq4cq.ffs@tglx> References: <877cwbq4cq.ffs@tglx> MIME-Version: 1.0 Message-ID: <167952396475.5837.11598351113694705444.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761108871454233598?= X-GMAIL-MSGID: =?utf-8?q?1761108871454233598?= |
Series |
[tip:,locking/core] locking/rwbase: Mitigate indefinite writer starvation.
|
|
Commit Message
tip-bot2 for Thomas Gleixner
March 22, 2023, 10:26 p.m. UTC
The following commit has been merged into the locking/core branch of tip: Commit-ID: 9d29d8e36cd6448966d83ab1acf946a2df3c2833 Gitweb: https://git.kernel.org/tip/9d29d8e36cd6448966d83ab1acf946a2df3c2833 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> AuthorDate: Tue, 21 Mar 2023 17:11:40 +01:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Wed, 22 Mar 2023 23:17:38 +01:00 locking/rwbase: Mitigate indefinite writer starvation. On PREEMPT_RT rw_semaphore and rwlock_t locks are unfair to writers. Readers can indefinitely acquire the lock unless the writer fully acquired the lock, which might never happen if there is always a reader in the critical section owning the lock. Mel Gorman reported that since LTP-20220121 the dio_truncate test case went from having 1 reader to having 16 readers and that number of readers is sufficient to prevent the down_write ever succeeding while readers exist. Eventually the test is killed after 30 minutes as a failure. Mel proposed a timeout to limit how long a writer can be blocked until the reader is forced into the slowpath. Thomas argued that there is no added value by providing this timeout. From a PREEMPT_RT point of view, there are no critical rw_semaphore or rwlock_t locks left where the reader must be preferred. Mitigate indefinite writer starvation by forcing the READER into the slowpath once the WRITER attempts to acquire the lock. Reported-by: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Mel Gorman <mgorman@techsingularity.net> Link: https://lore.kernel.org/877cwbq4cq.ffs@tglx Link: https://lore.kernel.org/r/20230321161140.HMcQEhHb@linutronix.de --- kernel/locking/rwbase_rt.c | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/kernel/locking/rwbase_rt.c b/kernel/locking/rwbase_rt.c index c201aad..25ec023 100644 --- a/kernel/locking/rwbase_rt.c +++ b/kernel/locking/rwbase_rt.c @@ -72,15 +72,6 @@ static int __sched __rwbase_read_lock(struct rwbase_rt *rwb, int ret; raw_spin_lock_irq(&rtm->wait_lock); - /* - * Allow readers, as long as the writer has not completely - * acquired the semaphore for write. - */ - if (atomic_read(&rwb->readers) != WRITER_BIAS) { - atomic_inc(&rwb->readers); - raw_spin_unlock_irq(&rtm->wait_lock); - return 0; - } /* * Call into the slow lock path with the rtmutex->wait_lock