lkml.org 
[lkml]   [2006]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH RT 0/2] futex priority based wakeup
    On Wed, May 10, 2006 at 04:32:14PM +0200, Thomas Gleixner wrote:
    > On Wed, 2006-05-10 at 15:03 +0200, Sébastien Dugué wrote:
    > > Maybe the pthread_cond_*() function should be made to use the
    > > PI-futexes support in glibc.
    >
    > <hack_alert>
    >
    > There is a simple way to do so. Just remove the assembler version of
    > pthread_cond_xx and use the generic c code implementation in glibc. That
    > allows you to use a PI mutex for the outer mutex.
    >
    > </hack_alert>

    I don't see how would that help. Both asm and sysdeps/pthread/*.c
    versions call __pthread_mutex_unlock_usercnt/__pthread_mutex_cond_lock,
    which will DTRT for the mutex passed as second argument to
    pthread_mutex_*wait (assuming you have Ulrich's/mine PI nptl patch).
    But, there are 2 other futexes used by condvars - internal condvar's lock
    and __data.__futex. If the associated mutex uses PI protocol, then
    I'm afraid the internal condvar lock needs to follow the same protocol
    (i.e. use FUTEX_*LOCK_PI), otherwise a low priority task calling
    pthread_cond_* and acquiring the internal lock, then scheduled away
    indefinitely because of some middle-priority CPU hog could delay
    some high priority task calling pthread_cond_* on the same condvar.
    But, there is a problem here - pthread_cond_{signal,broadcast} don't
    have any associated mutexes, so you often don't know which type
    of protocol you want to use for the internal condvar lock.
    Now, for the __data.__futex lock POSIX seems to be more clear,
    all it says is that the wake up should happen according to the scheduling
    policy (but, on the other side for pthread_mutex_unlock it says the same
    and we still use FIFO there).

    Jakub
    -
    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: 2006-05-10 17:04    [W:0.022 / U:1.396 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site