[lkml]   [2000]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: ll_rw_blk.c fails to merge requests. Help!
    > > reqfree-batching-3Name: reqfree-batching-3
    > > Type: Plain Text (text/plain)
    > This one works even better.
    > + list_add(&req->table, &q->pending_freelist);
    > + if (++q->pending_free > 64) {
    > ^^^^^

    I have two comments about this patch. (the reqfree-batching-3)

    First. Couldn't it end up indefinitely starving a writer?

    Assume the free_list is empty (all requests in use), and the
    pending_freelist is empty. (So q->queue_requests ==
    QUEUE_NR_REQUESTS). A write request
    comes in and is blocked in __get_request_wait. Now 64 ( 64 == 1/4 of
    QUEUE_NR_REQUESTS ) requests complete. The pending_freelist is spliced
    into the free_list and the wait_queue is woken. Now the writer will
    up in __get_request_wait, but will not succeed in get_request so it
    go back to sleep (queue_requests == 3/4 of QUEUE_NR_REQUESTS which is >
    than 1/2 of QUEUE_NR_REQUESTS). Meanwhile the 64 requests can be used
    by a) readers that were blocking, or b) new readers. This could
    ad infinitum...

    Second. At queue destroy time (blk_cleanup_queue) the pending_list
    be spliced into the free_list so they won't get leaked.
    add a 'count -= blk_cleanup_queue(&q->pending_list)'.

    David Mansfield
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 12:38    [W:0.024 / U:8.624 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site