Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3754658imm; Tue, 11 Sep 2018 01:19:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdasWg1ywhy9HqMCvbWXkGbbqoIlfPtcv7xSS8q+F2krCKoq+19OnnOnIPC46iYsygiRTwf4 X-Received: by 2002:a17:902:a413:: with SMTP id p19-v6mr25963500plq.220.1536653955271; Tue, 11 Sep 2018 01:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536653955; cv=none; d=google.com; s=arc-20160816; b=EilK0aKPmWIWLcLzNcyJBOUWRLEMzjxSIxl9rhbPZoAlOBQLTQrvtcjKlHn8UpO5pG H421Wn8bE5zt//80HXsVlnOtVrmdBh5/9ymJTe2Ny2S8rxMP/NfqwvlMIkl4U0xc9XEq v5cXq2D8BV4ty9x57jDT8E42X0YEmIHuAqwU9PbVQ3JAERIjXsFUadJMBRFKksk2l0DT niG2UUT7ljtJC1IKVEeQC5h6wVhgupq6KrLf1NIMFL3PYmXN4BoNZCXN5NgVQAZH3YFr tkEAZUyZvpGWjqvuH8Fz659438QHM+PDEh/INgBauLrBjxM4Jd25Dio533QvKsms/RRn KFiw== 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=kZv+heeb6T98P7ifVW9qK+gjgOGtkSdqkItcdvZjRTc=; b=vaRFkBVAgebNYGb0mWzLFEpxPFV9eGn0aGZ9WG19sTj4IMW7wfYYcbCZkz6khhmLZ4 P0aTYJm3DIjkjH19Pslgnk06v2YgHBWRnn57Zi0hENQ8SF5E3dRawg4q9iRX/iEpssgy BR4+2iMXMeU6IG1oxIqgXfBh7i0xpKhudyW+UAo7sPtIyTGpAYOnbs7xNRZjCBHNR4TV vLX41uLBd+WM5cNzibPbDi5uZC8mF9RhpljRy2tE1XezNTKNyNd2CB1J+kEAkEYG0Mf3 AXiuj15eOSkyYKLuVO3EyFyTH5zu+e8IuxUo5LMi6Yj4v6CNh0bvmvcRnH1aPREmXr/0 JJfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WjPidrZC; 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 z22-v6si17914658plo.219.2018.09.11.01.18.59; Tue, 11 Sep 2018 01:19:15 -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=WjPidrZC; 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 S1726801AbeIKNQO (ORCPT + 99 others); Tue, 11 Sep 2018 09:16:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59014 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbeIKNQO (ORCPT ); Tue, 11 Sep 2018 09:16:14 -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=kZv+heeb6T98P7ifVW9qK+gjgOGtkSdqkItcdvZjRTc=; b=WjPidrZCKpJKA3mPfdF2PymFB +wXcMYaYif4YX3rbDgajKmeisS+KqHzAEdKc64JguH7dmfDKefCRjA1SNCBCiYeECF3VeBx8baC27 vwktfzfeI3SVr2Qp+Ab8CHUBNGhrb8GZj/EEOrBCC+26iupihkNFIDGFAtvjynjnx3Zb4y1efDPnn dj8d11kodYqZRf2h/rd6d2f5wZKijKg2cLvCrnYhK7nBQpZFvVGziyqIJI5ipcIGPmjyox/NyEYpl +kK/lv/DW92eYxKvCe5NSLA8JlYTuA79QXkus5WZVOnUoYiZZLupVag4eJ2PJUcODKLVuzCSFZuLk VUPkAkwTA==; 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 1fzdrx-0004Zf-V5; Tue, 11 Sep 2018 08:17:58 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 53E3920163EFC; Tue, 11 Sep 2018 10:17:55 +0200 (CEST) Date: Tue, 11 Sep 2018 10:17:55 +0200 From: Peter Zijlstra To: Davidlohr Bueso Cc: Waiman Long , Ingo Molnar , Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH] locking/rwsem: Make owner store task pointer of last owning reader Message-ID: <20180911081755.GO24106@hirez.programming.kicks-ass.net> References: <1536265114-10842-1-git-send-email-longman@redhat.com> <20180910093156.GS24082@hirez.programming.kicks-ass.net> <83b333ea-8ef2-84ea-6810-4ab1a67eef88@redhat.com> <20180910171550.GA3902@linux-r8p5> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180910171550.GA3902@linux-r8p5> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 10, 2018 at 10:15:50AM -0700, Davidlohr Bueso wrote: > On Mon, 10 Sep 2018, Waiman Long wrote: > > > One major issue with a combined count/owner is that we may have to use > > cmpxchg for reader lock which will certainly impact reader-heavy > > workloads. I have also thought about ways to compress the task pointer > > address so that it can use fewer bits and leave the rests for reader > > count. It is probably doable on 64-bit systems, but likely not on 32-bit > > system given that there are less bits to play around. > > Yeah we've discussed this before. As a cleanup it would obviously be good, > but I fear about raw performance loss when using cmpxchg instead of xadd. Does it really matter though? Last time I looked at something similar (refcount_t) the "LOCK INCL" vs "LOCK CMPXCHG" was something like 15 vs 23 cycles (and that was with the cmpxchg loop actually doing a lot more). Do we really care about the down_read() path _that_ much? I thought that with the main pain point, pagefaults, the problem was mostly the line bouncing, not a few extra cycles.