Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5693599ybi; Tue, 4 Jun 2019 10:32:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz05BQKUXuLvID3YgpiP2R697Q9d1AlwVVkVJQvranyeUFpA9KMeS/91Lboq4nWAVB1c56R X-Received: by 2002:a62:bd11:: with SMTP id a17mr32186120pff.126.1559669560817; Tue, 04 Jun 2019 10:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559669560; cv=none; d=google.com; s=arc-20160816; b=qmZU6FOaejej2ycG5XDH86T02SD00vGPCZklqeX0aoMBkPhSNpaObRxPy24fuFtqtx ifKKb7JrpU3JyjtepJXyzi9zYlsheHCzIGi78JK10pV8H2wvyt8fT0WKskzkM/ewcyyk JmvSVlX3PSxOTmsgFMoYVdIRIqXCAxKfBXJex+Qjg3cDEpTcWRojTvr1jAyyEd+WcB4c eK8B3VcpGypaTDAXx8eJEli7k1sgMKivn1ICQS/2a/BtA3WKoj3EQDr/MMZCTss4tHa5 T5Pwz8E/Qz71zv1tDPEMnh2ax+E9LpsGJFukyySOPRM1PuZ0B2udgC6TqcPe1FVuUFzX s0/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=2GRxstDxqNsxTScKwF2djBTn3bIhmLln2cf2DiZ6FLw=; b=PgKNHceaN0BRCCInSONQgNi1D3VvdiQ4lOehWCbEGHHlH1nAJMs+iM38jiTuxBaGbb 7/1+yroH1sFLTe4nh9Dr3nToI4R0pl9JfTh75saFerr2MKnDXHbG5pSOqjFBp5vGZ1gx Crth8JA/wAKccWkMlOXlL7b3RTj3DrQQZBfEU3oP1UHlV6hyfqwDtEN1dBYXe/ZP0WUI LXO2Ly4Wfe4m+rGrep+IEs7TtZqeh6jj6DMQ7AhyrIW+ggEhybw1eTFZ1dVqPEOkHJ2C d6XA//iB+kW9aDSM9gKbmCrjcf9gczgvbptu4wYv9i0FNTzueFyG+aD3nwepP//lhXs1 Le+A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f69si12367800pjg.43.2019.06.04.10.32.24; Tue, 04 Jun 2019 10:32:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726502AbfFDRaC (ORCPT + 99 others); Tue, 4 Jun 2019 13:30:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48494 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbfFDRaC (ORCPT ); Tue, 4 Jun 2019 13:30:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EC3B2F8BC1; Tue, 4 Jun 2019 17:30:02 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-85.bos.redhat.com [10.18.17.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id E461919C69; Tue, 4 Jun 2019 17:30:00 +0000 (UTC) Subject: Re: [PATCH v8 15/19] locking/rwsem: Adaptive disabling of reader optimistic spinning To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , linux-kernel@vger.kernel.org, x86@kernel.org, Davidlohr Bueso , Linus Torvalds , Tim Chen , huang ying References: <20190520205918.22251-1-longman@redhat.com> <20190520205918.22251-16-longman@redhat.com> <20190604092008.GJ3402@hirez.programming.kicks-ass.net> From: Waiman Long Organization: Red Hat Message-ID: <8e7d19ea-f2e6-f441-6ab9-cbff6d96589c@redhat.com> Date: Tue, 4 Jun 2019 13:30:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190604092008.GJ3402@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 04 Jun 2019 17:30:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/4/19 5:20 AM, Peter Zijlstra wrote: > On Mon, May 20, 2019 at 04:59:14PM -0400, Waiman Long wrote: >> @@ -286,6 +325,7 @@ struct rwsem_waiter { >> struct task_struct *task; >> enum rwsem_waiter_type type; >> unsigned long timeout; >> + long last_rowner; >> }; >> #define rwsem_first_waiter(sem) \ >> list_first_entry(&sem->wait_list, struct rwsem_waiter, list) >> +static inline bool rwsem_reader_phase_trylock(struct rw_semaphore *sem, >> + long last_rowner) >> +static inline bool rwsem_reader_phase_trylock(struct rw_semaphore *sem, >> + unsigned long last_rowner) >> + waiter.last_rowner = atomic_long_read(&sem->owner); > That's somewhat inconsistent wrt the type. I'll make it unsigned long, > as that is what makes most sense, given there's a pointer inside. Thank for spotting that, I will fix it. -Longman