Skip to contentSkip to conversation

block: don't mark flush request as SOFTBARRIER

RFC In review Shaohua Li 2 participants 5 messages Sep 8, 2011 – Sep 14, 2011 Block layer

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

RFC 1/1 block: don't mark flush request as SOFTBARRIER

I'm wondering why flush request should be marked as SOFTBARRIER. Current flush sequence guarantees the correctness of flush even the request is reordered by ioscheduler.

block/elevator.c +0 -1
index a3b64bc..e589b76 100644
@@ -715,7 +715,6 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where)
 		break;
 
 	case ELEVATOR_INSERT_FLUSH:
-		rq->cmd_flags |= REQ_SOFTBARRIER;
 		blk_insert_flush(rq);
 		break;
 	default:
#1 lore raw

Hello,

Quoted 3 lines · Shaohua Li

I'm wondering why flush request should be marked as SOFTBARRIER. Current flush sequence guarantees the correctness of flush even the request is reordered by ioscheduler.

The primary reason would be because when those flush data requests are put on the dispatch queue, it doesn't go through elv_dispatch_sort(). SOFTBARRIERs function as dispatch sort boundaries and queueing flush data request at the head w/o SOFTBARRIER would confuse dispatch sorting, and we want to put it at the head of dispatch queue to decrease latency for flush sequence.

Thanks.

Signature · 1 line
tejun
author
#2 lore raw
Quoted 7 lines · Tejun Heo

Hello,

Quoted 3 lines · Shaohua Li

I'm wondering why flush request should be marked as SOFTBARRIER. Current flush sequence guarantees the correctness of flush even the request is reordered by ioscheduler.

Quoted 6 lines

The primary reason would be because when those flush data requests are put on the dispatch queue, it doesn't go through elv_dispatch_sort(). SOFTBARRIERs function as dispatch sort boundaries and queueing flush data request at the head w/o SOFTBARRIER would confuse dispatch sorting, and we want to put it at the head of dispatch queue to decrease latency for flush sequence.

we do the flush first and then dispatch the data. The flush is already delayed a lot, so if latency is a problem, we already saw it. Why not just remove SOFTBARRIER and use elv_dispatch_sort() for flush data so drive can better arrange requests?

Thanks,
Shaohua

#3 lore raw

Hello, Shaohua.

Quoted 3 lines · Shaohua Li

we do the flush first and then dispatch the data. The flush is already delayed a lot, so if latency is a problem, we already saw it.

I don't necessarily agree with the above. We don't induce any extra latency for flushes which don't overlap.

Quoted 2 lines

Why not just remove SOFTBARRIER and use elv_dispatch_sort() for flush data so drive can better arrange requests?

Maybe, I don't know. Elevator sorting on writes is likely to be much less important to begin with. Combined with the fact that sorting flush data would require more writes to be flushed by the following flush, I don't think it would be clear which way would be better. If it can be shown that sorting flush data is better, why not?

Thanks.

Signature · 1 line
tejun
author
#4 lore raw
Quoted 10 lines · Tejun Heo

Hello, Shaohua.

Quoted 3 lines · Shaohua Li

we do the flush first and then dispatch the data. The flush is already delayed a lot, so if latency is a problem, we already saw it.

I don't necessarily agree with the above. We don't induce any extra latency for flushes which don't overlap.

Quoted 8 lines
Quoted 2 lines

Why not just remove SOFTBARRIER and use elv_dispatch_sort() for flush data so drive can better arrange requests?

Maybe, I don't know. Elevator sorting on writes is likely to be much less important to begin with. Combined with the fact that sorting flush data would require more writes to be flushed by the following flush, I don't think it would be clear which way would be better. If it can be shown that sorting flush data is better, why not?

Just found request_queue->queue_head list usually has only one entry, because drive only takes one extra request from elevator. so either dispatch_sort() or dispatch_add_tail() has no difference.

Thanks,
Shaohua