Re: [patch 05/15] Generic Mutex Subsystem, mutex-core.patch

From: Steven Rostedt
Date: Mon Dec 19 2005 - 00:13:00 EST


On Mon, 2005-12-19 at 02:37 +0100, Ingo Molnar wrote:
> +static inline void __mutex_unlock_nonatomic(struct mutex *lock
> __IP_DECL__)
> +{
> + struct thread_info *ti = current_thread_info();
> + unsigned long flags;
> +
> + debug_lock_irqsave(&debug_lock, flags, ti);
> + spin_lock(&lock->wait_lock);
> +
> +#ifdef CONFIG_DEBUG_MUTEXESS
> + DEBUG_WARN_ON(lock->magic != lock);
> + DEBUG_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
> + DEBUG_WARN_ON(lock->owner != ti);
> + if (debug_on) {
> + DEBUG_WARN_ON(list_empty(&lock->held_list));
> + list_del_init(&lock->held_list);
> + }
> +#endif
> +

The unlikely below is only for the non MUTEX_LOCKLESS_FASTPATH case.
Maybe have a define for the unlikely?

#ifdef MUTEX_LOCKLESS_FASTPATH
# define UNLIKELY_SLOW(x) x
#else
# define UNLIKELY_SLOW(x) unlikely(x)
#endif

-- Steve


> + if (unlikely(!list_empty(&lock->wait_list)))
> + __mutex_wakeup_waiter(lock __IP__);
> +#ifdef CONFIG_DEBUG_MUTEXESS
> + lock->owner = NULL;
> +#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/