[lkml]   [2009]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] spinlock: __raw_spin_is_locked() should return true for UP
On Tue, 18 Aug 2009, Linus Torvalds wrote:
> > Thinking about it, UP probably should have spin_is_locked always return
> > false, but if you want to make sure you are not in a critical section
> > with the lock not held, then use assert_spin_locked, which on UP should be
> > a nop.
> That's what we do. That said, I also think we should generally try to
> avoid the kind of code that depends on spin_is_locked always returning
> false, for the same reason we should try to avoid any code that depends on
> it always returning true.

Perhaps we can deprecate spin_is_locked and replace it with
"expect_spin_locked" and "expect_spin_unlocked" which on SMP would return
true and false respectively if the lock was locked. But both would always
return true on UP.

Or do some thing similar, that would remove the ambiguity on UP.

-- Steve

 \ /
  Last update: 2009-08-19 02:11    [W:0.044 / U:7.220 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site