Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964788AbVLVL54 (ORCPT ); Thu, 22 Dec 2005 06:57:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964804AbVLVL54 (ORCPT ); Thu, 22 Dec 2005 06:57:56 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:13203 "EHLO pentafluge.infradead.org") by vger.kernel.org with ESMTP id S964788AbVLVL5z (ORCPT ); Thu, 22 Dec 2005 06:57:55 -0500 Date: Thu, 22 Dec 2005 11:57:53 +0000 From: Christoph Hellwig To: Ingo Molnar Cc: lkml , Linus Torvalds , Andrew Morton , Arjan van de Ven , Nicolas Pitre , Jes Sorensen , Zwane Mwaikambo , Oleg Nesterov , David Howells , Alan Cox , Benjamin LaHaise , Steven Rostedt , Christoph Hellwig , Andi Kleen , Russell King Subject: Re: [patch 5/9] mutex subsystem, core Message-ID: <20051222115753.GB30964@infradead.org> Mail-Followup-To: Christoph Hellwig , Ingo Molnar , lkml , Linus Torvalds , Andrew Morton , Arjan van de Ven , Nicolas Pitre , Jes Sorensen , Zwane Mwaikambo , Oleg Nesterov , David Howells , Alan Cox , Benjamin LaHaise , Steven Rostedt , Andi Kleen , Russell King References: <20051222114233.GF18878@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051222114233.GF18878@elte.hu> User-Agent: Mutt/1.4.2.1i X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1568 Lines: 56 > +#include we don't need config.h anymore, it's included implicitly now. > +#include Any chance we could include this after the headers ? > +#include What do we need this one for? > +struct mutex { > + // 1: unlocked, 0: locked, negative: locked, possible waiters please use /* */ comments. > + atomic_t count; > + spinlock_t wait_lock; > + struct list_head wait_list; > +#ifdef CONFIG_DEBUG_MUTEXES > + struct thread_info *owner; > + struct list_head held_list; > + unsigned long acquire_ip; > + const char *name; > + void *magic; > +#endif > +}; I know we generally don't like typedefs, but mutex is like spinlocks one of those cases where the internals should be completely opaqueue, so a mutex_t sounds like a good idea. > +#include What do you we need this header for? > +static inline void __mutex_lock_atomic(struct mutex *lock) > +{ > +#ifdef __ARCH_WANT_XCHG_BASED_ATOMICS > + if (unlikely(atomic_xchg(&lock->count, 0) != 1)) > + __mutex_lock_noinline(&lock->count); > +#else > + atomic_dec_call_if_negative(&lock->count, __mutex_lock_noinline); > +#endif > +} this is the kind of thing I meant in the comment to the announcement. Just having this in arch code would kill all these ifdefs over mutex.c - 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/