Thread (14 messages) 14 messages, 3 authors, 2018-11-15

Re: [PATCH V7 1/4] blk-mq: refactor the code of issue request directly

From: Ming Lei <hidden>
Date: 2018-11-14 09:43:57
Also in: lkml

On Wed, Nov 14, 2018 at 05:23:48PM +0800, jianchao.wang wrote:
Hi Ming

On 11/14/18 5:11 PM, Ming Lei wrote:
quoted
quoted
 
-	if (!blk_mq_get_dispatch_budget(hctx))
-		goto insert;
+	if (unlikely(!blk_mq_get_dispatch_budget(hctx)))
+		goto out_unlock;
The unlikely annotation is a bit misleading, since out-of-budget can
happen frequently in case of low queue depth, and there are lots of
such examples.
This could be good for the case for no .get_budget and getting budget success.
In case of out-of-budget, we insert the request which is slow path.
In case of low queue depth, it is hard to say that 'insert request' is
done in slow path, cause it happens quite frequently.

I suggest to remove these two unlikely() since modern CPU's branch prediction
should work well enough.

Especially the annotation of unlikely() often means that this branch is
missed in most of times for all settings, and it is obviously not true
in this case.


thanks,
Ming
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help