Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp552275imm; Wed, 23 May 2018 01:21:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZruhBkiL2zIBVpeNGUMr8u+IYQuMcOq+92cc+gr3e4UkwG9vAd8N+NyxtTPHPp4h7DOwt8O X-Received: by 2002:a17:902:4b:: with SMTP id 69-v6mr2030124pla.178.1527063715784; Wed, 23 May 2018 01:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527063715; cv=none; d=google.com; s=arc-20160816; b=S3Pn4N8IrXp5UWqNrQBRYfRWgyxwL3a4vqwh4ER2N1Nz0B7WW4Xev0nJhwIVDdKxEr pHqml6xdnvznoy+KlvJ/5BFJUzwTn5qTgz3/laCqx5JHuFZJ5SvbErgubUZhlx3roWNX DXnHd4synV92gDoz22xGuUhMIKYMN/LgrCM5TAHs2kVDE9/OBN8JhnFaUY9Bx80f8V/4 GPz9rBTnikY06pNC4H3HvbmSrty7ob9TN4/zOsF1ymZU9wnHN3FgAYR53oO99fBFaZTQ Q1y4GTFhWvmT0p7o0oBc3+5puAvZpVtYWX0qwHXtTfp2IwsRQ7DaZKe+2zKkCXD81sY6 IyMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=XUdGjGyr5pvDNfjZlNftg55I9p/MOIFlhDTw+RIruwo=; b=ozlaKKY71SfZgkBbURPrmPkQqtB9xhO1Tw7CZ3YGRsCMZ/m05uriP8giLenOvIHhR2 YYJPwMdA2OHZ0n1GNo3v6CYtWg+Q3uHA2Nzz98Hyg5yoUzvL1P406HbHZgTg9OnHI9xU 8vosXACIkpWHVJGynNYWIR8dP9VIxYIyGjeCWkQvgKv4eqTO+5N2c+pLVB2UDTQiGNmy bv68xeYazpZ/n8R6XT0421UtIBjMJurIIvf+uNnKhBU9F9lr06gynZs3LrmENu5ZBuRe gbR+fwKE6PeXfplJ42mKHEkDv5AxW/yrX/vEH7RTof1N418eooFLT79/wN+dfyrfUi3C 0TpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=s7SBkwsE; 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 m2-v6si18717770pfb.259.2018.05.23.01.21.41; Wed, 23 May 2018 01:21:55 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=s7SBkwsE; 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 S1754214AbeEWIUF (ORCPT + 99 others); Wed, 23 May 2018 04:20:05 -0400 Received: from merlin.infradead.org ([205.233.59.134]:33444 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754153AbeEWIUB (ORCPT ); Wed, 23 May 2018 04:20:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XUdGjGyr5pvDNfjZlNftg55I9p/MOIFlhDTw+RIruwo=; b=s7SBkwsE9p3vYiw4IR60RutUQ JplYy51/xKLnqsjfILoHjuDvQ/Ys01knJZqLlNDhN0Vc8iK2gN2K3LeZLK25NObkMhHl+RX8xfa9Q FFe05jI+avXovRM4cbJONy0OdCfQtcI9K5WzzIPPlFDtTVvVOFYAZk1ckH1oTCMJGm17UfIJQnqNi Vmhni3yye38dgCc5VRRa9iFMQ2eoX5mkkxu+s2T/MaPK0lXOAQFUfgThLVdg2A0/mYeBtu3fJWOYG 6ZSn4iYV+i+Vy86TFZgK76NOrXxPVzmshGrxoJDcN0fjZlV5IcAGV7LytMee3n+WAXxN9h1Op8szu /C/d2afNw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLOzh-0000EJ-2U; Wed, 23 May 2018 08:19:37 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7DCAA2029F86E; Wed, 23 May 2018 10:19:34 +0200 (CEST) Date: Wed, 23 May 2018 10:19:34 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: psodagud@codeaurora.org, Kees Cook , Andy Lutomirski , Will Drewry , Andrew Morton , Rik van Riel , Thomas Gleixner , Ingo Molnar , Eric Biggers , Frederic Weisbecker , sherryy@android.com, Vegard Nossum , Christoph Lameter , Andrea Arcangeli , Sasha Levin , Linux Kernel Mailing List Subject: Re: write_lock_irq(&tasklist_lock) Message-ID: <20180523081934.GT12217@hirez.programming.kicks-ass.net> References: <0879f797135033e05e8e9166a3c85628@codeaurora.org> <20180522211724.GR12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 02:31:42PM -0700, Linus Torvalds wrote: > On Tue, May 22, 2018 at 2:17 PM Peter Zijlstra wrote: > > > qrwlock is a fair lock and should not exhibit writer starvation. > > We actually have a special rule to make it *not* be fair, in that > interrupts are allowed to take the read lock if there are readers - even if > there are waiting writers. Urgh, right.. would be interesting to know how much of that is happening in that workload. I assumed the readers were mostly due to the syscalls the reporter talked about, and those should not trigger that case. > > You basically want to spin-wait with interrupts enabled, right? > > That was the intent of my (untested) pseudo-code. It should work fine. Note > that I used write_trylock() only, so there is no queueing (which also > implies no fairness). > > I'm not saying it's a _good_ idea. I'm saying it might work if all you > worry about is the irq-disabled part. Right, if you make it unfair and utterly prone to starvation then yes, you can make it 'work'.