• Bart Van Assche's avatar
    block/mq-deadline: Micro-optimize the batching algorithm · d672d325
    Bart Van Assche authored
    When dispatching the first request of a batch, the deadline_move_request()
    call clears .next_rq[] for the opposite data direction. .next_rq[] is not
    restored when changing data direction. Fix this by not clearing .next_rq[]
    and by keeping track of the data direction of a batch in a variable instead.
    
    This patch is a micro-optimization because:
    - The number of deadline_next_request() calls for the read direction is
      halved.
    - The number of times that deadline_next_request() returns NULL is reduced.
    
    Cc: Damien Le Moal <damien.lemoal@wdc.com>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Ming Lei <ming.lei@redhat.com>
    Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20210618004456.7280-13-bvanassche@acm.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    d672d325
mq-deadline.c 22.8 KB