Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3958812yba; Wed, 17 Apr 2019 01:19:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjCBExxdDHifnUWx+Db2VrAHrPsM/VUMBl93hUdc2Yri3V5yZGkgDFVv2qvkgm8u/0uauM X-Received: by 2002:a17:902:6b8b:: with SMTP id p11mr63558409plk.225.1555489157264; Wed, 17 Apr 2019 01:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555489157; cv=none; d=google.com; s=arc-20160816; b=09Jnx2jXcxuYG2+FlMjrFKleik9qpAgWPfWFeDnU18e/UeIrZ06aUkm8nW1tcgmQZ6 LDcukct3d24fgAD39OQ++ZP4uyP1aIozdUTLmKKaRcD50QBNHvBIyQx2cYI3GKWmWS26 YWqvT+lS6XBlvmxYDMu6m06jWs0G2MHKo9UnJl8sj1frVHpnNfzyWotMvADDJnaRWY+F pAen13jLHUjcyqfxiO6kYYaCg2g1hh2aRTrbV5pEfz6coKlluissp6hySGfCPwtL/MQW k9aeOLuWE5S5irg7j87UHOGvpFToDBZhZrKG05dT7MxKp2NZWyJ6/cZ2/ykU8Tf6bSOt Zj8Q== 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=pYAuHHbOcOLzRvW3LJKBYNzptxR3y0sDsbp8vk7QfjA=; b=a5aowxVzxZKmrUwoLYLGSGCzPS8kIlLehsogQCwvCibqBK8ui/x6ZIPyUa3Le5eI34 GXaV3kX3CZv7CfwtMA7BF7aYDZhPLeDFqIIBtTzwOEL0PZNk3K5fdJiTtkgwvGCW7AKq mZlLzrRw+SHZMcuKct7y2z12s30HaS35IDogHPhHFz6p3jlH0NWp9oD637SFgZ137pjH ji5+f4iA4Q03wkUho8z/+/MYzQ4TmDpW+OtTe2Zp/x/urBKxD+G37/QTjJZNbpzDcZ96 P1TXXt5TRE9xhnw2LWCqhwLGHWFh0XS84DFIT+gqPWy7UossZGefzNSCaF7RrFak+ztJ dDDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hrt29oHw; 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 u9si41943163plq.162.2019.04.17.01.19.02; Wed, 17 Apr 2019 01:19:17 -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=hrt29oHw; 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 S1731293AbfDQIRq (ORCPT + 99 others); Wed, 17 Apr 2019 04:17:46 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42958 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfDQIRq (ORCPT ); Wed, 17 Apr 2019 04:17:46 -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=pYAuHHbOcOLzRvW3LJKBYNzptxR3y0sDsbp8vk7QfjA=; b=hrt29oHwxRZZmiVKlMXLCzwcR RugB7TsZIGMXwM6pw77jgouyQAKUfkOjkighmMkty9bYgQXf40s6WbkgaFbRO9JNtUBlAZD1GjRj+ gi0dDsmGjOwhnTs5O7a6ZHqaEIie6zHhhx0tVqCaAKxSdYb7Y4HL+zGVXLtzYrGiAlcRkDLfcIA5g g/OAFRuuX9H0ybWzC9yjc8wjtmz3oyR6Y8Rt/XjAIBjJcjT5z8Wn4cR0ioJS4H0fILt3Xp+4IY8pp 3yN4nkIbZlAcN5UC4/b7+REu0Rklya7sezcHNFSdU8KlrWwohYIvy2XNOzt36+bwMU2jHybKXHvQn u0DU7uV6g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGflF-0008Sc-Ht; Wed, 17 Apr 2019 08:17:41 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9C15329B52933; Wed, 17 Apr 2019 10:17:39 +0200 (CEST) Date: Wed, 17 Apr 2019 10:17:39 +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 , huang ying Subject: Re: [PATCH v4 07/16] locking/rwsem: Implement lock handoff to prevent lock starvation Message-ID: <20190417081739.GB4038@hirez.programming.kicks-ass.net> References: <20190413172259.2740-1-longman@redhat.com> <20190413172259.2740-8-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190413172259.2740-8-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 Sat, Apr 13, 2019 at 01:22:50PM -0400, Waiman Long wrote: > +/* > + * This is safe to be called without holding the wait_lock. Because.... @waiter is *our* waiter and it's not going anywhere. So when it's first, it stays first until we do something about it. > + */ > +static inline bool > +rwsem_waiter_is_first(struct rw_semaphore *sem, struct rwsem_waiter *waiter) > +{ > + return list_first_entry(&sem->wait_list, struct rwsem_waiter, list) > + == waiter; > +}