>
> >    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
wake  
up in __get_request_wait, but will not succeed in get_request so it
will  
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
up 
by a) readers that were blocking, or b) new readers.  This could
continue
ad infinitum...

Second.  At queue destroy time (blk_cleanup_queue) the pending_list
should
be spliced into the free_list so they won't get leaked. 
Alternatively,   
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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to