From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction abstraction Date: Wed, 18 Jun 2008 17:49:51 -0700 (PDT) Message-ID: References: <1213831403.8011.24.camel@pasglop> <4859A149.9090004@goop.org> <4859A528.1010107@goop.org> <4859AA47.2020903@goop.org> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: In-Reply-To: <4859AA47.2020903@goop.org> Sender: linux-kernel-owner@vger.kernel.org To: Jeremy Fitzhardinge Cc: benh@kernel.crashing.org, xen-devel , Peter Zijlstra , kvm-devel , x86@kernel.org, LKML , Virtualization Mailing List , Hugh Dickins , Ingo Molnar , Thomas Gleixner List-Id: virtualization@lists.linuxfoundation.org On Wed, 18 Jun 2008, Jeremy Fitzhardinge wrote: > > It's not cmpxchg, just xchg. > In other words, is: > > lock btr $_PAGE_BIT_RW, (%rbx) Well, we can actually do it as lock andl $~_PAGE_RW,(%rbx) although we haven't bothered (I've wanted several times to make clear_bit() do that, but have never gotten around to it - mainly because old gcc versions didn't work with __builtin_constant_p() in inline functions - so you have to do the macro from hell) And yes, the "lock andl" should be noticeably faster than the xchgl. Linus