Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3365587yba; Tue, 16 Apr 2019 09:53:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPljISVY6nv7BX4rGsu3cD7MQ1d8a957Pdt5lMTc8KSiUdlR6z66nBW/DYtLLJ5d11MHCo X-Received: by 2002:a17:902:294b:: with SMTP id g69mr34487736plb.57.1555433588590; Tue, 16 Apr 2019 09:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555433588; cv=none; d=google.com; s=arc-20160816; b=kdUGnaRlTIw7p+bw3yr1gquqS2FUFIT6JSItHMA+WSCdq48mYcOgerAHTOno8Mc3eU ADRrL70ns7RsfAlXk84eNsh/5rK6VrgXMH1cs0onweH7fN6S5aTuQZ/s/uUaq+NED1e7 2xuFa7nh65CyX76fYzZNiNZzO1VJrwNAJUaD6g9kknNKFj3CRvLtVUjhK1SPg/1QzKm+ vBn4TzSZkzzGFKV875a9WCpo3E0SnOvOd95VEB1DBfi/SSLluUbHuWmUacV7KDsY++mW +QLWtj6KtiAnTNQKSK07P7Rp1jvtKHSPzBWs29BFLYaU15IcwcH6g/GbiX5tfeYZfMvT PTlw== 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=O5SlkOVXbbrWWcD7GxQq0XkpCCGH+vuFbCOJri1nSiY=; b=sqYx0PdHauvr91ypicoZL9BjAWHUWWaZB5E3V50czTsphbt2mhwzChiNaLHbCWkHK2 ZVS0VeGNO0uQZkQVnEVcf8YSLi7GA68kHjwbgG0Tv0aXi9H+dUU1970ne4A0mpNiX3ui w5IwIZ3C1ukDHRg2Haig85Gbix5+oGawny8n0eU9ZTRqNrSRTDOPySan12oRlrvPPgDo BwmrIaTjB3RxIfdZgRXLIc1CgTYnrXKXxggplCo0qKA+vQlNJCviZ/uO42ZA9PGEIMzw dv6hZ3ocfAQpjI5mHwWyooNyza9BxAEwucyErn1txocUagbCuZ2G9ph9p0E0vlprouvA OHSg== 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 j21si39062682pgm.232.2019.04.16.09.52.52; Tue, 16 Apr 2019 09:53:08 -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 S1729406AbfDPQus (ORCPT + 99 others); Tue, 16 Apr 2019 12:50:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:38558 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728093AbfDPQus (ORCPT ); Tue, 16 Apr 2019 12:50:48 -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 2AAE6B0B8; Tue, 16 Apr 2019 16:50:47 +0000 (UTC) Date: Tue, 16 Apr 2019 09:50:38 -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 , huang ying Subject: Re: [PATCH v4 10/16] locking/rwsem: Wake up almost all readers in wait queue Message-ID: <20190416165038.xfjserwdhli6p222@linux-r8p5> References: <20190413172259.2740-1-longman@redhat.com> <20190413172259.2740-11-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190413172259.2740-11-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 Sat, 13 Apr 2019, Waiman Long wrote: >+/* >+ * We limit the maximum number of readers that can be woken up for a >+ * wake-up call to not penalizing the waking thread for spending too >+ * much time doing it. >+ */ >+#define MAX_READERS_WAKEUP 0x100 Although with wake_q this is not really so... Could it at least be rewritten, dunno something like so: /* * Magic number to batch-wakeup waiting readers, even when writers * are also present in the queue. This both limits the amount of * work the waking thread must do (albeit wake_q) and also prevents * any potential counter overflow, however unlikely. */ I'm still not crazy about this artificial limit for the readers-only case, but won't argue. I certainly like the reader/writer case. Thanks, Davidlohr