From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37BEEC10F12 for ; Wed, 17 Apr 2019 08:17:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBB1F2073F for ; Wed, 17 Apr 2019 08:17:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hrt29oHw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731298AbfDQIRr (ORCPT ); Wed, 17 Apr 2019 04:17:47 -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; > +}