Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3970906yba; Tue, 23 Apr 2019 12:42:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPvCW2UsCffXucWt2t81Y5gsLV9LdIPEpwxw0qnIY5c1EU3pd5v/IumHj7Et5hoYjaJhDi X-Received: by 2002:a63:360c:: with SMTP id d12mr26035817pga.404.1556048563461; Tue, 23 Apr 2019 12:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556048563; cv=none; d=google.com; s=arc-20160816; b=BzqmfwsgEVVB7eI2cw6OvVoOta01NMNO5G8GYe0yAOoMnxF502iw4B4ziE2LnyDF/W DUFFP6cNdEEdd1JGWhFK3FiCDVtoCRxwmRjd2zaPwme66T2HlMjzuGtkg8/a43M7GJGS BLE1x8Y6ql2K0QP0TntjzdZsMuwqldJi+xb6S3b6XVI2oE1hXynSFq81E7ixDsm2wftF DISCh8sLnWzQSrW4GknuLOVV8OdFQ0C8sLvVgHckvPKEp65ix8ro8hTCvRpGyjQtK/e0 XQS5+PaZ2ZGPMJ46CsxHvjDNHe+az4ZdqT6HfMVO7Bw+DtvjEoB8DNdusWSe5TXlmYrR kb3g== 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=ookwCdRUCC5hDXWedEhZr+AR6XtOqnQhDwU8AZviopY=; b=cYcD/JBmmASiTnNEE3kw6jPtzkPhruFraFGZrXk7ccFeFb3b6dexP61idMrthUVsd+ G+WUCV1dMcZl/e4NJgN7CaUpi+Lhw+cT6JM2qu1FvtJMUvJYQ7gmDAHAEJMhRwxIQTRm eexH/dFPA3FPkBwmiHRhBovXYR1u3zOvfHQ0MAW6Sg5A9jQq+QO41pTtO31sG7a87/Dv yifiUCVWXXoQtv/GUGPT0i9Jkh+Q45uoi9KIB56R3D0QVFqJ42xURll6wvWlIpyuRla0 QaqqsM2ZRqYm2XDQTuzBT8TXSjPIB/YHbjFDbk29NKqVTaqnEX4xEdvLkvgZ8Dxcx+22 216w== 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 l37si16774128plb.173.2019.04.23.12.42.26; Tue, 23 Apr 2019 12:42:43 -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 S1726342AbfDWTlf (ORCPT + 99 others); Tue, 23 Apr 2019 15:41:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50952 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbfDWTlf (ORCPT ); Tue, 23 Apr 2019 15:41:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B16CC3087942; Tue, 23 Apr 2019 19:41:34 +0000 (UTC) Received: from llong.remote.csb (ovpn-123-167.rdu2.redhat.com [10.10.123.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 709155C1B5; Tue, 23 Apr 2019 19:41:33 +0000 (UTC) Subject: Re: [PATCH v4 14/16] locking/rwsem: Guard against making count negative To: Peter Zijlstra Cc: Linus Torvalds , Ingo Molnar , Will Deacon , Thomas Gleixner , Linux List Kernel Mailing , the arch/x86 maintainers , Davidlohr Bueso , Tim Chen , huang ying References: <4cbd3c18-c9c0-56eb-4e01-ee355a69057a@redhat.com> <20190419102647.GP7905@worktop.programming.kicks-ass.net> <20190419120207.GO4038@hirez.programming.kicks-ass.net> <20190419130304.GV14281@hirez.programming.kicks-ass.net> <20190419131522.GW14281@hirez.programming.kicks-ass.net> <57620139-92a3-4a21-56bd-5d6fff23214f@redhat.com> <7b1bfc26-6e90-bd65-ab46-08413acd80e9@redhat.com> <20190423141714.GO11158@hirez.programming.kicks-ass.net> <4f62d7f2-e5f6-500e-3e70-b1d1978f7140@redhat.com> <20190423193435.GX4038@hirez.programming.kicks-ass.net> From: Waiman Long Organization: Red Hat Message-ID: <88ba7be0-9ec5-941e-1b3f-80fbe05fe3a0@redhat.com> Date: Tue, 23 Apr 2019 15:41:32 -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: <20190423193435.GX4038@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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 23 Apr 2019 19:41:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/23/19 3:34 PM, Peter Zijlstra wrote: > On Tue, Apr 23, 2019 at 03:12:16PM -0400, Waiman Long wrote: >> On 4/23/19 12:27 PM, Linus Torvalds wrote: >>> On Tue, Apr 23, 2019 at 7:17 AM Peter Zijlstra wrote: >>>> I'm not aware of an architecture where disabling interrupts is faster >>>> than disabling preemption. >>> I don't thin kit ever is, but I'd worry a bit about the >>> preempt_enable() just because it also checks if need_resched() is true >>> when re-enabling preemption. >>> >>> So doing preempt_enable() as part of rwsem_read_trylock() might cause >>> us to schedule in *exactly* the wrong place, >> You are right on that. However, there is a variant called >> preempt_enable_no_resched() that doesn't have this side effect. So I am >> going to use that one instead. > Only if the very next line is schedule(). Otherwise you're very much not > going to use that function. May I know the reason why. I saw a number of instances of preempt_enable_no_resched() without right next a schedule(). Cheers, Longman