lkml.org 
[lkml]   [2009]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] spinlock: __raw_spin_is_locked() should return true for UP
    On Tue, Aug 18, 2009 at 04:52:20PM -0700, Linus Torvalds wrote:
    >
    >
    > On Tue, 18 Aug 2009, Steven Rostedt wrote:
    > >
    > > > The thing is, some people may assert that a lock is held, but others could
    > > > easily be looping until it's not held using something like
    > > >
    > > > while (spin_is_locked(lock))
    > > > cpu_relax();
    > >
    > > Wouldn't something like that be really racey? And anyone doing such a
    > > thing had better have that code within an #ifdef CONFIG_SMP.
    >
    > Sure, it's hopefully inside a #ifdef CONFIG_SMP.
    >
    > And no, it's not necessarily racy. Sure, it's race in itself if that's all
    > you are doing, but I could imagine writing that kind of code if I knew
    > some lock was likely held, and I wanted to avoid doing a "try_lock()"
    > until it got released.

    So you'd basically have the effect of a spin_lock(), except with the
    bonus of breaking RT hacks that do something other than spin, and
    preventing arch code from doing certain types of relaxation that are only
    appropriate when waiting on a lock (such as mdors on powerpc, which
    de-emphasizes until a reservation is broken).

    Not exactly something we should encourage, IMHO.

    -Scott


    \
     
     \ /
      Last update: 2009-08-19 20:53    [W:3.854 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site