Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268920AbUIMUWM (ORCPT ); Mon, 13 Sep 2004 16:22:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268959AbUIMUWL (ORCPT ); Mon, 13 Sep 2004 16:22:11 -0400 Received: from bay-bridge.veritas.com ([143.127.3.10]:51998 "EHLO MTVMIME01.enterprise.veritas.com") by vger.kernel.org with ESMTP id S268928AbUIMUTM (ORCPT ); Mon, 13 Sep 2004 16:19:12 -0400 Date: Mon, 13 Sep 2004 21:18:58 +0100 (BST) From: Hugh Dickins X-X-Sender: hugh@localhost.localdomain To: Tonnerre cc: Roman Zippel , Alex Zarochentsev , Paul Jackson , William Lee Irwin III , Hans Reiser , , Andrew Morton , Martin Schwidefsky Subject: Re: 2.6.9-rc1-mm4 sparc reiser4 build broken - undefined atomic_s ub_and_test In-Reply-To: <20040913200359.GE19399@thundrix.ch> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1097 Lines: 24 On Mon, 13 Sep 2004, Tonnerre wrote: > On Mon, Sep 13, 2004 at 06:03:28PM +0200, Roman Zippel wrote: > > +#define atomic_add_and_test(i,v) (atomic_add_return((i), (v)) == 0) > > +#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) > > This is no longer atomic, is it? I mean, there's no guarantee that the > atomic_add_return and the comparison are executed without > interruption, is there? It's true that the atomic_add_return and the comparison are not executed atomically, but they don't need to be: a value is equal to 0, or not, however long ago that value was computed, no matter what happened since. The important thing is that the value is the atomic result of the atomic operation: which may not be the case when you use atomic_add followed by atomic_read, but is what's guaranteed by atomic_add_return. Hugh - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/