[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0804010202390.5541@jikos.suse.cz>
Date: Tue, 1 Apr 2008 02:08:35 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Ingo Molnar <mingo@...e.hu>
cc: linux-kernel@...r.kernel.org
Subject: spinlocks -- why are releases inlined and acquires are not?
Hi,
include/linux/spinlock.h shows:
#define spin_lock_irq(lock) _spin_lock_irq(lock)
unconditionally, i.e. irrespectible of config options, we always (on SMP)
call kernel/spinlock.c:_spin_lock_irq(), which is even not inlined.
Contrary to that, unlocks are written as one would expect, i.e:
#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || \
!defined(CONFIG_SMP)
# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
#else
# define spin_unlock_irq(lock) \
do { \
__raw_spin_unlock(&(lock)->raw_lock); \
__release(lock); \
local_irq_enable(); \
} while (0)
and __raw_spin_unlock() is of course properly inlined.
What is the reason for this asymetry? Shouldn't the acquiring functions be
implemented in the very same way? Or at least, shouldn't all the
__lockfunc functions be inlined?
Thanks,
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists