Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepin: Use BFQ as the elevator for SQ rotate devices #421

Open
wants to merge 2 commits into
base: linux-6.6.y
Choose a base branch
from

Conversation

opsiff
Copy link
Member

@opsiff opsiff commented Sep 16, 2024

For hdd optimize.
Question:
1.How to test QUEUE_FLAG_NONROT?
2.It is correct time to get the flag??
3.If we can get the flag,so we can only use BFQ elevator for hdd.

Link:zen-kernel/zen-kernel@c614dbb

For hdd optimize.
Question: 
1.How to test QUEUE_FLAG_NONROT?
2.It is correct time to get the flag??
3.If we can get the flag,so we can only use BFQ elevator for hdd.

Link:zen-kernel/zen-kernel@c614dbb
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff
Copy link
Member Author

opsiff commented Sep 16, 2024

这个修改道理上来说应该系统来改,系统侧拿到了/sys/block/sd{X}/queue/rotational的值可以判断是否是机械盘,如果是0就是非机械盘,是1就是机械盘然后做这个修改。
这个修改的效果可以参考论文《Evolution of the BFQ Storage-I/O Scheduler》

@opsiff opsiff changed the title deepin: Use BFQ as the elevator for SQ devices [WIP] deepin: Use BFQ as the elevator for SQ devices Sep 16, 2024
@opsiff
Copy link
Member Author

opsiff commented Sep 16, 2024

这个修改道理上来说应该系统来改,系统侧拿到了/sys/block/sd{X}/queue/rotational的值可以判断是否是机械盘,如果是0就是非机械盘,是1就是机械盘然后做这个修改。 这个修改的效果可以参考论文《Evolution of the BFQ Storage-I/O Scheduler》

这个方案初步看是可行的,blk_queue_flag_set(QUEUE_FLAG_NONROT在下面调用流程之前被设置,所以这样判断是可行的。
对ssd的流程:
blk_queue_flag_set(QUEUE_FLAG_NONROT
device_add_disk->
elevator_init_mq->
elevator_get_default-> choose mq-deadline
对hdd的流程:
device_add_disk->
elevator_init_mq->
elevator_get_default-> choose bfq

@opsiff opsiff changed the title [WIP] deepin: Use BFQ as the elevator for SQ devices deepin: Use BFQ as the elevator for SQ rotate devices Sep 16, 2024
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 <guanwentao@uniontech.com>
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • elevator_get_default函数中,使用了#if defined(CONFIG_IOSCHED_BFQ)预处理器指令来根据是否定义了CONFIG_IOSCHED_BFQ来选择不同的分支。这种做法可能会导致代码重复,如果将来需要添加更多的条件分支,将需要修改多个地方。
  • 函数elevator_get_default的返回类型是static struct elevator_type *,但是没有对返回值进行任何处理或检查,只是简单地返回了elevator_find_get的调用结果。这可能意味着函数的返回值被假设为总是有效的,但实际上可能存在elevator_find_get调用失败或返回无效值的情况。

是否建议立即修改:

@Avenger-285714
Copy link
Collaborator

这个修改道理上来说应该系统来改,系统侧拿到了/sys/block/sd{X}/queue/rotational的值可以判断是否是机械盘,如果是0就是非机械盘,是1就是机械盘然后做这个修改。 这个修改的效果可以参考论文《Evolution of the BFQ Storage-I/O Scheduler》

mst-2015.pdf

@Avenger-285714
Copy link
Collaborator

实际的优化效果需要测试数据报告留档

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants