Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7104761ybi; Wed, 5 Jun 2019 11:16:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpMcpJ8ZAlZPIas3VwH9wVhYChSWMpLFHyq2Y3NWy5ewiGl/n6BaEYFs9P+fLDhd5GCaX1 X-Received: by 2002:a17:902:42d:: with SMTP id 42mr43808830ple.228.1559758591081; Wed, 05 Jun 2019 11:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559758591; cv=none; d=google.com; s=arc-20160816; b=yZ0U8GXNaZvT7bG0mvZN05spwrR6ivVY0pDFUeux242sHzNfmPwtRKV1ylzFjOAWTv d/Dc9mb5Y1vDzYsEJAWB3dOs7Ad4zMfuivaEzhmlf6WI9leAwskljmqo/+LdENYCAU8W lKwUXg1Ce0j3exuehj3cM8k4e8h9/YdwHZsukeKfimOU3WgV/sNMkRoVp/uMSFIM8fWy mvAn3pD3UE5vtJL1lm+NMe22UkoW7TLcOCn0ooSfv5kiuWvXjbf3+81V8R5ikiW/U+ee 3CTzibvvq/p3McYWXXjazRPeojcnrVOAF139puk5PMwU15Ojm3O8aVxPfNfPqlZDxGbm tMEQ== 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:references:cc:to:from:subject; bh=egXpTdq2LMjzTi258aqnuLJe7KGdPjMi2dsC60djxnU=; b=1D/umn4r40KuXxi+nGuLy64HI49zvUNTAfBvskkfhmPJfecIrgyxrqgQygItB1SYbp Y2f/oI90d0NIDO9OdkIT+2KX5Lnd+LJeuuEo2kWp5GzS2AwTyi8KS/WE8osQ2CPt14Qd f85RGgMlJb3Tky4VRsnRO0IlPMmRWuLzPaO6VSICGQomnzKXwhfTRqMfk1hCmq5KtBOB TQoE2f4v1OFbYKplVKu7c78ILTCZkYncW8PJE9+jsyzXxOD5igq7j6Bc66H4KsJ1Vp7f UGw+0SnY7HFPADbMsOPj4Dy4oY9ieQZT+mYXxkTLcOjx2dId+SGUGb2k0s1mePlgWB9P vddA== 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 z19si30246272pfa.260.2019.06.05.11.16.14; Wed, 05 Jun 2019 11:16:31 -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 S1726599AbfFESNs (ORCPT + 99 others); Wed, 5 Jun 2019 14:13:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46030 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbfFESNs (ORCPT ); Wed, 5 Jun 2019 14:13:48 -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 0807330C1205; Wed, 5 Jun 2019 18:13:33 +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 5ACEF2B3CC; Wed, 5 Jun 2019 18:13:28 +0000 (UTC) Subject: Re: [PATCH v8 15/19] locking/rwsem: Adaptive disabling of reader optimistic spinning From: Waiman Long 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> <8e7d19ea-f2e6-f441-6ab9-cbff6d96589c@redhat.com> <20190604173853.GG3419@hirez.programming.kicks-ass.net> <20190604181426.GH3419@hirez.programming.kicks-ass.net> Organization: Red Hat Message-ID: <46e44f43-87fd-251b-3b83-89a8bb3b407f@redhat.com> Date: Wed, 5 Jun 2019 14:13:27 -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: 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.46]); Wed, 05 Jun 2019 18:13:48 +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 2:21 PM, Waiman Long wrote: > On 6/4/19 2:14 PM, Peter Zijlstra wrote: >>> I worked on this owner merging patch mainly to alleviate the need to use >>> cmpxchg for reader lock. cmpxchg_double() is certainly one possible >>> solution though it won't work on older CPUs. We can have a config option >>> to use cmpxchg_double as it may increase the size of other structures >>> that embedded rwsem and impose additional alignment constraint. >> cmpxchg8b was introduced with the Pentium (for PAE IIRC, it enabled >> atomic 64bit PTEs, but Linux never used it for that) and every Intel/AMD >> thereafter has had it. AFAIK there's no x86_64 chip without cmpxchg16b. > Thank for the clarification. I actually didn't check when cmpxch8b was > introduced. I know it is a bit slower than regular cmpxchg. So we may > still need to do some performance analysis to see how it compares with > my current approach. Using cmpxchg_double is actually more risky than I thought. I have been trying to try to use cmpxchg_double for down_write, but I kept getting kernel panics because the rwsem wasn't 16b-aligned. As rwsem is embedded in quite a large number of structures, they all have to align properly to make that work or the kernel will panic. That does seem too risky to me. So I am dropping the idea of trying to use it. Cheers, Longman