All of lore.kernel.org
 help / color / mirror / Atom feed
* spinlocks -- why are releases inlined and acquires are not?
@ 2008-04-01  0:08 Jiri Kosina
  2008-04-01  0:40 ` Jiri Kosina
  0 siblings, 1 reply; 9+ messages in thread
From: Jiri Kosina @ 2008-04-01  0:08 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-04-01 13:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01  0:08 spinlocks -- why are releases inlined and acquires are not? Jiri Kosina
2008-04-01  0:40 ` Jiri Kosina
2008-04-01  8:33   ` Ingo Molnar
2008-04-01  8:38     ` Jiri Kosina
2008-04-01  8:43       ` Ingo Molnar
2008-04-01  8:44         ` Jiri Kosina
2008-04-01 11:12       ` Andi Kleen
2008-04-01 12:40         ` Jiri Kosina
2008-04-01 13:30           ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.