Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4945682yba; Wed, 10 Apr 2019 08:09:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/kMQU3xdUnecWPm/0tbR4lBV12eEZrBKDAs/nMt63ftoJjg1E5epnjhlsvsty0WKxAk7M X-Received: by 2002:a17:902:70cc:: with SMTP id l12mr44193610plt.10.1554908974988; Wed, 10 Apr 2019 08:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554908974; cv=none; d=google.com; s=arc-20160816; b=gdV/rjUzUBHM3eSTBo6OCXE8imfJyuRMv8hH12QGceDA7zEQHw40i0DJl/q5giuR6w Y/JZjzk50meHFQPbZvyobgfAQMnD9g1Smy9MJeIVX3UfdVGa6/pplt4L1x8mIvtbmBql FcRU055yqIpgll5Xz//auFgtb0CiEBQqHIjo+3LflOEGfTxs0DeRVOB8ZpS2OWzmv9Ln amYyUE2IMdfuyFIwrA90yQPsL1MRhWm50zy33HYBVWto0FoOhbGlR+nXHY2uYw0i6XIl 8HMRjlc+dUp6C5sG9mIcdm6bdmn1mLKh2c4DPxokqyJ54fUuEVbbS05VDt8mMf6DO4Bh vPJg== 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; bh=Dn2JbVhnhjXRkDyjKbZgpcJeD9yYMXMOg6VKmD5Y37E=; b=U5lQNhO5DKSWVLVeVyU30ruWF/sPYQzi3gi0HOJVxvb+eG5mVpPp7HJTT6buhf72DK JLdX1zHAW82S4gJ1whbajA/af760durVYjeljEh3mltEl9yO/nlLBnwsUVgV+zta533T n9g7g8h8ylq90iSMqImvyR6oHYpUCm0wPg+WaTLWOZUYBZITZE2yNEH6g0aLWPUZ31Zn 5RxcJowZdw0JuEMpqd45FItVvzQKxZt/6DXjRpTzhASrI6IKL5YxjovUCHIelHgy0tou vhNpPDVSRobGUH2cFVqNQqJkt0jHqAW5jRA3QXE+/5ZwrQZA9W1C5Ht6DKt5gvmkycis J7IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RWCcaS+G; 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 w71si23647247pgd.470.2019.04.10.08.09.18; Wed, 10 Apr 2019 08:09:34 -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=bombadil.20170209 header.b=RWCcaS+G; 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 S1733019AbfDJPHX (ORCPT + 99 others); Wed, 10 Apr 2019 11:07:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55584 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732830AbfDJPHW (ORCPT ); Wed, 10 Apr 2019 11:07:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=Dn2JbVhnhjXRkDyjKbZgpcJeD9yYMXMOg6VKmD5Y37E=; b=RWCcaS+G9SH+VjJPy2QZN9WGx pM3odcMZEW+irj54ciHNk/AADDQTqg8YPRXq7hBJFIwVjlVCy0GmJ308djV2rLROaD3mEKkv2gLDa O8Q2WheSDTgO9xCwbXbZTqM73oqU7tWc+csfZ+hUK4m4dkdnrlF9l7EE04gk7FKGwN2UYAOIB+zHh Lb5qu+227wAN4E7WDrhImpSR1s3wGqdMCJOwQ9cWl2nwzqVusJXDWlI6XzstV02H3xX82vSQdDsmL CTaDTEtv3jl58nkHzbjiVMUBB7wqDkn7XigFczXhERwfmyX7d4BhwK0UbTBGuId2Fu2eT5JLU9SrR bWjFOfH3Q==; Received: from [89.200.33.100] (helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEEon-0004Yq-UP; Wed, 10 Apr 2019 15:07:18 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 5737D984F06; Wed, 10 Apr 2019 17:07:14 +0200 (CEST) Date: Wed, 10 Apr 2019 17:07:14 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , linux-kernel@vger.kernel.org, x86@kernel.org, Davidlohr Bueso , Linus Torvalds , Tim Chen Subject: Re: [PATCH-tip v2 02/12] locking/rwsem: Implement lock handoff to prevent lock starvation Message-ID: <20190410150714.GK7905@worktop.programming.kicks-ass.net> References: <20190405192115.17416-1-longman@redhat.com> <20190405192115.17416-3-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190405192115.17416-3-longman@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 05, 2019 at 03:21:05PM -0400, Waiman Long wrote: > Because of writer lock stealing, it is possible that a constant > stream of incoming writers will cause a waiting writer or reader to > wait indefinitely leading to lock starvation. > > The mutex code has a lock handoff mechanism to prevent lock starvation. > This patch implements a similar lock handoff mechanism to disable > lock stealing and force lock handoff to the first waiter in the queue > after at least a 5ms waiting period. The waiting period is used to > avoid discouraging lock stealing too much to affect performance. So the mutex code doesn't have that timeout, it foces the handoff if the top waiter fails to acquire. I don't find the above sufficiently justifies the additional complexity. What were the numbers with the simple scheme vs this etc..