lkml.org 
[lkml]   [2004]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH][5/8] Arch agnostic completely out of line locks / ppc64


    On Thu, 9 Sep 2004, Zwane Mwaikambo wrote:
    >
    > I think cpu_relax() (or some other primitive) should actually take a
    > parameter, this will allow for us to use monitor/mwait on i386 too so
    > that in cases where we're spinning waiting on memory modify we could do
    > something akin to the following;
    >
    > while (spin_is_locked(lock))
    > cpu_relax(lock);

    You can't do it that way. It needs to be arch-specific. When using
    something like monitor/mwait (or a "futex", which something like UML might
    use), you need to load the value you want to wait on _before_. So the
    interface literally would have to be the monitor/mwait interface:

    for (;;) {
    lockval = monitor(lock);
    if (!is_locked(lockval))
    break;
    mwait(lock, lockval);
    }

    and the fact is, this is all much better just done in the arch-specific
    spinlock code.

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

    \
     
     \ /
      Last update: 2009-11-18 23:46    [W:2.752 / U:0.060 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site