From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755355AbYFBXED (ORCPT ); Mon, 2 Jun 2008 19:04:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753546AbYFBXDx (ORCPT ); Mon, 2 Jun 2008 19:03:53 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:59922 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753075AbYFBXDv (ORCPT ); Mon, 2 Jun 2008 19:03:51 -0400 Date: Tue, 3 Jun 2008 01:03:17 +0200 From: Ingo Molnar To: Linus Torvalds Cc: Nick Piggin , David Howells , Ulrich Drepper , Linux Kernel Mailing List , Andrew Morton Subject: Re: [PATCH 0/3] 64-bit futexes: Intro Message-ID: <20080602230316.GA24159@elte.hu> References: <4840C29B.6030507@redhat.com> <4840CE51.9060109@redhat.com> <4840D63F.2090407@redhat.com> <20080602185433.GB4081@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Linus Torvalds wrote: > > That bit can be used as a lock and if all access to the state of > > that atomic variable uses it, arbitrary higher-order atomic state > > transitions can be derived from it. The cost would be a bit more > > instructions in the fastpath, but there would still only be a single > > atomic op (the acquire op), as the unlock would be a natural barrier > > (on x86 at least). > > No, "unlocks as a natural barrier" only works for exclusive kernel > locks (spin_unlock and write_unlock). There we can just do a write to > unlock. But for anything that wants to handle contention differently > than just spinning, the unlock path needs to be able to do an atomic > "unlock and test if I need to do something else", because it may need > to wake things up. yeah, indeed. Compared to all the other costs that have to be dealt with here, having a second atomic op isnt all that much of an issue either, especially on latest hw. An atomic op will probably never be as cheap as a non-atomic op, but ~20 cycles is still plenty fast for most practical purposes. Ingo