Skip to contentSkip to conversation

2.4.1-pre10 deadlock (Re: ps hang in 241-pre10)

DISCUSSION Jens Axboe 2 participants 3 messages Jan 28, 2001 1 message not in the archive Block layer

lore
Share & tools
lore

Jens Axboe

author
#1 lore raw
In reply to a message not in the archive
Quoted 9 lines · Lorenzo Allegrucci
Quoted 9 lines

Ho humm. Jens: imagine that you have more people waiting for requests than "batchcount". Further, imagine that you have multiple requests finishing at the same time. Not unlikely. Now, imagine that one request finishes, and causes "batchcount" users to wake up, and immediately another request finishes but THAT one doesn't wake anybody up because it notices that the freelist isn't empty - so it thinks that it doesn't need to wake anybody.

Lorenzo, does the problem go away for you if you remove the

Quoted 7 lines
Quoted 5 lines
	if (!list_empty(&q->request_freelist[rw])) {
		...
	}

code from blkdev_release_request() in drivers/block/ll_rw_block.c?

Yes, it does.

How about this instead?

block/ll_rw_blk.c renamed from opt/kernel/linux-2.4.1-pre10/drivers/block/ll_rw_blk.c +2 -0
@@ -633,6 +634,8 @@
 		if (!list_empty(&q->request_freelist[rw])) {
 			blk_refill_freelist(q, rw);
 			list_add(&req->table, &q->request_freelist[rw]);
+			if (waitqueue_active(&q->wait_for_request))
+				wake_up_nr(&q->wait_for_request, 2);
 			return;
 		}
 
Signature · 6 lines
* Jens Axboe <[email protected]>
* SuSE Labs
-
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/
#2 lore raw
Quoted 2 lines · Jens Axboe

How about this instead?

I really don't like this one. It will basically re-introduce the old behaviour of waking people up in a trickle, as far as I can tell. The reason we want the batching is to make people have more requests to sort in the elevator, and as far as I can tell this will just hurt that.

Are there any downsides to just _always_ batching, regardless of whether the request freelist is empty or not? Sure, it will make the "effective" size of the freelist a bit smaller, but that's probably not actually noticeable under any load except for the one that empties the freelist (in which case the old code would have triggered the batching anyway).

Performance numbers?

Linus

-
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/

author
#3 lore raw
In reply to Jens Axboe
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Jens Axboe

How about this instead?

I really don't like this one. It will basically re-introduce the old behaviour of waking people up in a trickle, as far as I can tell. The reason we want the batching is to make people have more requests to sort in the elevator, and as far as I can tell this will just hurt that.

Quoted 5 lines

Are there any downsides to just _always_ batching, regardless of whether the request freelist is empty or not? Sure, it will make the "effective" size of the freelist a bit smaller, but that's probably not actually noticeable under any load except for the one that empties the freelist (in which case the old code would have triggered the batching anyway).

The problem with removing the !list_empty test like you suggested is that batching is no longer controlled anymore. If we start batching once the lists are empty and start wakeups once batch_requests has been reached, we know we'll give the elevator enough to work with to be effective. With !list_empty removed, batch_requests is no longer a measure of how many requests we want to batch. Always batching is not a in problem in itself, the effective smaller freelist effect should be neglible.

The sent patch will only trickle wakeups in case of batching already in effect, but batch_request wakeups were not enough to deplete the freelist again. At least that was the intended effect :-)

Quoted 1 line

Performance numbers?

Don't have any right now, will test a bit later.

Signature · 6 lines
* Jens Axboe <[email protected]>
* SuSE Labs
-
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/