lkml.org 
[lkml]   [2004]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [2/4] consolidate bit waiting code patterns
    William Lee Irwin III <wli@holomorphy.com> wrote:
    >
    > +int __sched __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q,
    > + void *word, int bit,
    > + int (*wait)(void *), unsigned mode)
    > +{
    > + int ret;
    > +
    > + while (test_and_set_bit(bit, word)) {
    > + prepare_to_wait_exclusive(wq, &q->wait, mode);
    > + if (test_bit(bit, word)) {
    > + if ((ret = (*wait)(word)))
    > + return ret;
    > + }
    > + }
    > + finish_wait(wq, &q->wait);
    > + return 0;
    > +}

    Some comments over this thing would be nice.

    The `wait' argument seems to be misnamed. It typically points at
    sync_page(), yes? Maybe it should be called `action' or `kick' or
    something.

    If (*wait)() returns non-zero then it looks to me like the callers will get
    confused, thinking that the page did come unlocked?

    If (*wait)() returns non-zero then we need to run finish_wait(), no?
    -
    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: 2005-03-22 14:05    [W:0.020 / U:1.864 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site