Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3077007imm; Mon, 10 Sep 2018 10:37:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbQcC/GxSkOTnpU2/ir+Fx6Xrfu23by7XENDTL8LP0+S8bKj9ghoVWwY9lbp6JooBmxAZi+ X-Received: by 2002:a17:902:5a4c:: with SMTP id f12-v6mr11953260plm.298.1536601079021; Mon, 10 Sep 2018 10:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536601078; cv=none; d=google.com; s=arc-20160816; b=QivCRH5FydFIOs9rC4OmvHgOczG8SpNkN48GDet+8//yALONvpRMyVSLJ9pPOOY9vu Wph+K9BuW9pErlsp0JZyVmDSKI+jiTqkWb0yV7B93O5d0WL5CKqyuB06EDvW1cFHvpst dENIbRNkXCt03EjlWIRRmxgtW6EOH3xyiyzn2yC4LRSIzxerRLapvMv9S7VXO23muYxi 17/CpzEwLEWOZ6k46F0Phx/qvAZmFtDIJeUSDAGeLmWONZwngiuUt52u/4UWypjS0FVD NSA2dYErqWsSw0GEF8o9Wx+xWUeYZFC9Ih3jkcE83NLGgP7Nl6/KZghDzOP4vZzwgzy8 aifQ== 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=DML7K7liNyHgyzuUkWrJgaLMMfKjqqYryi51SrQIpuo=; b=SAAYDLU2Q744o47rCet5RezKiyj9GiSnSqW/HszCCC8y3IuqIOyxgR6v7uTy8+9ftk TgE2wURqLetLAWYUHJfoiYmWCohhCW0/0sQ043gExn2KDQLlwVoEg40H8ig3dMSvhH1M x4mhFF4yQJtZps0oC6jaS2j/X6ALCjFLAyZOXjLVJfTVzBnetvw9iXkutZcJ6XXXyTws Y7fWuKsAfdp2fiikOWvieV8bQ8A+MzU2b5qrUlnzE4E7q9fRebqqp1Ro5LM/9eRyZhnB AiWWmel+MbH4tISqcLHFagYCLsXux961WpUI/bcJbpsGMCOFSHbMZzKCU15xo53/ejpA tofg== 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 y12-v6si18346277pfd.254.2018.09.10.10.37.42; Mon, 10 Sep 2018 10:37:58 -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 S1728150AbeIJWbE convert rfc822-to-8bit (ORCPT + 99 others); Mon, 10 Sep 2018 18:31:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60746 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726755AbeIJWbE (ORCPT ); Mon, 10 Sep 2018 18:31:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BB92400C3C0; Mon, 10 Sep 2018 17:35:54 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-55.bos.redhat.com [10.18.17.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23CDE1134CC9; Mon, 10 Sep 2018 17:35:54 +0000 (UTC) Subject: Re: [PATCH] locking/rwsem: Make owner store task pointer of last owning reader To: Davidlohr Bueso Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , linux-kernel@vger.kernel.org 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> From: Waiman Long Organization: Red Hat Message-ID: <70273024-d40a-e7bb-740a-629089d169f8@redhat.com> Date: Mon, 10 Sep 2018 13:35:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20180910171550.GA3902@linux-r8p5> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 10 Sep 2018 17:35:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 10 Sep 2018 17:35:54 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/10/2018 01:15 PM, 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. I don't think using cmpxchg for writers will be a performance issue. However, using cmpxchg for readers will be. One thought that I have is to use the tid of the writer on the lower half and use the upper half for reader count. However, there is some overhead in translating tid to task pointer. So I don't know how useful that may be. So we may still need to keep the owner field around. Cheers, Longman