Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5131284yba; Wed, 10 Apr 2019 12:03:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwFHsn1i85aHs15hwt0l9qfrHTewvCdiez8opkhuGhihhC2L6D/ykMwEpLtP8JYjyMrzV5 X-Received: by 2002:a17:902:302:: with SMTP id 2mr22692878pld.232.1554922995266; Wed, 10 Apr 2019 12:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922995; cv=none; d=google.com; s=arc-20160816; b=CpmDMQAHtNEnWwkGpAQQ0encuk5KCoN2SlmEYaU4VUjruHlZUaZ2DDtxrXwhbjyX/o kO0MyNmlxD33EYszl89XP4F+FE8ipbqMY7C+ZI14dXBM85wgD+1hmGIAcAzXi3eJvpj1 oHORPim1Xv8qMf6VPZ7cdJtdOtKSdOj2vTA0YZugzd6UraZFML1B6nj2HEmlaYtpJqua Eqv19/IlHOdh+5ypWw596JQBq2fUpBSTQ7r+yBsKtz4GiaXfwkN1l+vn06+AUGr9P+02 h9p3QC6MqXUV8iLl1dEcc7m8v684PWC6wl+e+GYgR17UNK/6Q3II8bZjrtLMN+1d5ySq yBNQ== 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; bh=TrdAoU7b+CBDVLyxXXsgyB4JmJoyuXjxvQmsZzWB17M=; b=LmMgL4cAuaiz1TwdwvUZwNe1FfZOzuo/pQZuuauX06npJQGBeemVDtHTf+lNBQFJZH 7zjpctHTfX/91CM+By3hg43ZF4MsboUHv5N7pjTJX8zWQOU5F3hZAoZ2WKJYutOvQt3j UCL+yg0h5a6Ivn2zuA5r66GFooujVM/Pb9LNNEO4/L/hbInEicGGdfL1xCOjaKQFhnJW RVajsTXmoXfHLZ66gLJkAQITtSxZM2OLlvKPmEIXzvm4vQso2fMuyZNbD8zKE8q/naf9 zwct1IaFFbAhXOqZW/FQryYTI4v7nT14XqWEgKIGgjN78n0pCvgOuZLxvlEcG1blRefB OM7A== ARC-Authentication-Results: i=1; mx.google.com; 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 p5si1426097plo.273.2019.04.10.12.02.58; Wed, 10 Apr 2019 12:03:15 -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; 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 S2388074AbfDJQuX (ORCPT + 99 others); Wed, 10 Apr 2019 12:50:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:50526 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388065AbfDJQuX (ORCPT ); Wed, 10 Apr 2019 12:50:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 99FAEAD5E; Wed, 10 Apr 2019 16:50:21 +0000 (UTC) Date: Wed, 10 Apr 2019 09:50:13 -0700 From: Davidlohr Bueso To: Waiman Long Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Thomas Gleixner , linux-kernel@vger.kernel.org, x86@kernel.org, Linus Torvalds , Tim Chen Subject: Re: [PATCH-tip v2 06/12] locking/rwsem: Wake up almost all readers in wait queue Message-ID: <20190410165013.njy5bg32pxq6syyr@linux-r8p5> References: <20190405192115.17416-1-longman@redhat.com> <20190405192115.17416-7-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190405192115.17416-7-longman@redhat.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 05 Apr 2019, Waiman Long wrote: >When the front of the wait queue is a reader, other readers >immediately following the first reader will also be woken up at the >same time. However, if there is a writer in between. Those readers >behind the writer will not be woken up. > >Because of optimistic spinning, the lock acquisition order is not FIFO >anyway. The lock handoff mechanism will ensure that lock starvation >will not happen. > >Assuming that the lock hold times of the other readers still in the >queue will be about the same as the readers that are being woken up, >there is really not much additional cost other than the additional >latency due to the wakeup of additional tasks by the waker. Therefore >all the readers up to a maximum of 256 in the queue are woken up when >the first waiter is a reader to improve reader throughput. Before we stopped waking readers when a writer was encountered but would otherwise wakeup _all_ readers. I don't understand why you want to limit this to MAX_READERS_WAKEUP, otherwise I agree it's nice to skip the writer and continue waking readers in the queue (with the handoff guarantees obviously). Would it not be better to do the MAX_READERS_WAKEUP limit only when a writer is found? Thanks, Davidlohr