Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp656102imm; Fri, 31 Aug 2018 09:42:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaxOc+R9ksCV8bDFq/c7oTn8W0y52hwXDy8zGE48Rs4/cw3sk64VUUQzBgDNCVmy7rEhqlH X-Received: by 2002:a63:67c3:: with SMTP id b186-v6mr3597003pgc.5.1535733731287; Fri, 31 Aug 2018 09:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535733731; cv=none; d=google.com; s=arc-20160816; b=iCIsTqEJxKAP3YTYTX6DIhjlxYUOunq7rKRlncl5zv6NHx0nQpnCU+tvliVTY8qsjq OrGquLY1qUuX6lHCjJ7wiRYNGhZPiea4UUmyX2L8vtdYJ3r//6tC1b/F9lK555+B25GX vTI1Trr6krqU7VCnSpceyPW3b/oEKgH6+FQL1fOhIVhS9N1tDruV/+ZxTT0Wb5SUhVGD 9tQ68WmPtzbGr3QM5lfxcPUDHpEjT0zShP5RV4d3k24SEy3CUXx0W6i23MOW56pGfn8Q a6jg6sr18aliFWisQ1bnE5uILUVHU4bcZW5WnFAw6pNEO3e3nUVT1bsapw4vRY6Lyqko h8Cg== 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:arc-authentication-results; bh=aZaMyeYIzW94zNlfZHWpOYH8K8AlT31808LtMB8uB4I=; b=OTYdZli4/oLOKw1us2xbXggKRsBZlqDlBytDl8yS5H2ZZ8FyiLtyLCpXZclNPM4CC5 PEXkucRZ6TM4uXXX7OZMInDSB9EcLaTBzDde4ZTyUEseAzO78S4GVlcNHuTThNRZjfEY 1s0U41jnPLmi1sv86hOlgtfz619zmnmlx5d4xxBn/f844G/N0y9KoRsN0V5fMfxcXE1M hMJxnnIOnC1V/IVy4aXdS7xNLz+4UBsKA6cvfO7D9lKhikir+6fA27RDj6ayzDooVp2B gaQ6BE5M/wQrfKr9wPZd1p5mwbiKkOweGx932Gbwc2t6iKmbJn6y0qpmUv8hyXrLf5cc cWDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Yzf1GoE8; 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 h187-v6si11643959pfb.62.2018.08.31.09.41.56; Fri, 31 Aug 2018 09:42:11 -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=merlin.20170209 header.b=Yzf1GoE8; 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 S1728139AbeHaUiW (ORCPT + 99 others); Fri, 31 Aug 2018 16:38:22 -0400 Received: from merlin.infradead.org ([205.233.59.134]:49636 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbeHaUiW (ORCPT ); Fri, 31 Aug 2018 16:38:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=aZaMyeYIzW94zNlfZHWpOYH8K8AlT31808LtMB8uB4I=; b=Yzf1GoE8pn56Kp3h24nmTfkc2 FfpOA1i+0P7EMZAHVN6pta/Nh4RdwtrnhsuSJsaH1wOB6lOYLOqwDe9i86wSJZbe3ZI7+NdO8zbqX n20Hwl03bEUFIvFPbkmCzrg2OOYm4uLgYXaXwsh85HN0k0Z1H1v7CHHOZ+dpVDqzxDBWJUyHViLi8 VJ2r7mCdXaW6SXjoLq4mhAPOCx2QO72991pq7j/KGwy0oXTPYQpqOBhsRX4HGQiR4ZJ1eFDlrZ0E2 0X1YahIbkLV3arzj5i8BByaDXXXsD+3us2mcxUIOiGk+/lZraKdiyRKgG08OsiHm4BeMbHEaphsex pJo1ljD+Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvmIa-0008AA-0B; Fri, 31 Aug 2018 16:29:28 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F232A2024D700; Fri, 31 Aug 2018 18:29:20 +0200 (CEST) Date: Fri, 31 Aug 2018 18:29:20 +0200 From: Peter Zijlstra To: Dave Hansen Cc: Yu-cheng Yu , Jann Horn , the arch/x86 maintainers , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , kernel list , linux-doc@vger.kernel.org, Linux-MM , linux-arch , Linux API , Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Florian Weimer , hjl.tools@gmail.com, Jonathan Corbet , keescook@chromiun.org, Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , ravi.v.shankar@intel.com, vedvyas.shanbhogue@intel.com Subject: Re: [RFC PATCH v3 12/24] x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for _PAGE_DIRTY_SW Message-ID: <20180831162920.GQ24124@hirez.programming.kicks-ass.net> References: <1535660494.28258.36.camel@intel.com> <1535662366.28781.6.camel@intel.com> <20180831095300.GF24124@hirez.programming.kicks-ass.net> <1535726032.32537.0.camel@intel.com> <1535730524.501.13.camel@intel.com> <6d31bd30-6d5b-bbde-1e97-1d8255eff76d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d31bd30-6d5b-bbde-1e97-1d8255eff76d@linux.intel.com> 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 Fri, Aug 31, 2018 at 08:58:39AM -0700, Dave Hansen wrote: > On 08/31/2018 08:48 AM, Yu-cheng Yu wrote: > > To trigger a race in ptep_set_wrprotect(), we need to fork from one of > > three pthread siblings. > > > > Or do we measure only how much this affects fork? > > If there is no racing, the effect should be minimal. > > We don't need a race. > > I think the cmpxchg will be slower, even without a race, than the code > that was there before. The cmpxchg is a simple, straightforward > solution, but we're putting it in place of a plain memory write, which > is suboptimal. Note quite, the clear_bit() is LOCK prefixed.