From ad0a462a673b35ee1bec34e9abd0e98bfaccab38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=98=E6=80=80?= Date: Tue, 17 Sep 2024 00:03:29 +0800 Subject: [PATCH] deepin: only use BFQ as the elevator for single queue rotate devices Why: bfq elevator shows high bandwidth in read/write than other in hdd.[1] Question: It is correct time to get the flag? If we can get the flag,so we can only use BFQ elevator for hdd. or it is same as before. Answer: It is ok for: use this macro:blk_queue_flag_set(QUEUE_FLAG_NONROT for no rotate block device like ssd: blk_queue_flag_set(QUEUE_FLAG_NONROT device_add_disk-> elevator_init_mq-> elevator_get_default-> choose mq-deadline for rotate device like hdd: device_add_disk-> elevator_init_mq-> elevator_get_default-> choose bfq Link:https://ieeexplore.ieee.org/document/7469567 [1] Signed-off-by: Wentao Guan --- block/elevator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index 2d9a78a54636..b4e5a09fbcc6 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -576,7 +576,9 @@ static struct elevator_type *elevator_get_default(struct request_queue *q) !blk_mq_is_shared_tags(q->tag_set->flags)) return NULL; #if defined(CONFIG_IOSCHED_BFQ) - return elevator_find_get(q, "bfq"); + if (!blk_queue_nonrot(q)) + return elevator_find_get(q, "bfq"); + return elevator_find_get(q, "mq-deadline"); #else return elevator_find_get(q, "mq-deadline"); #endif