From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757781AbYFSAvV (ORCPT ); Wed, 18 Jun 2008 20:51:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755887AbYFSAvN (ORCPT ); Wed, 18 Jun 2008 20:51:13 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:58811 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954AbYFSAvM (ORCPT ); Wed, 18 Jun 2008 20:51:12 -0400 Date: Wed, 18 Jun 2008 17:49:51 -0700 (PDT) From: Linus Torvalds 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 Subject: Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction abstraction In-Reply-To: <4859AA47.2020903@goop.org> Message-ID: References: <1213831403.8011.24.camel@pasglop> <4859A149.9090004@goop.org> <4859A528.1010107@goop.org> <4859AA47.2020903@goop.org> User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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