Unable to change queue parameter for nr_requests on nvme device

295 篇文章 0 订阅

https://access.redhat.com/solutions/3429731

Unable to change queue parameter for nr_requests on nvme device

 SOLUTION 已验证 - 已更新 2018年九月25日01:40 - 

English 

环境

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Intel PCIe Data Center (DC) SSD NVME controller

问题

  • When changing the parameter of /sys/block/nvme1/queue/nr_requests from 128 to 512 the system outputs errors like:

    Raw

    # echo 512 > /sys/block/nvme1/queue/nr_requests
    -bash: echo: write error: Invalid argument
    

决议

As nvme devices do not use the regular IO scheduler mechanism used by sd devices, the nr_request parameter is not applicable to nvme stack. The IO handling mechanism in nvme uses blk-mq.

根源

IO scheduler is currently not supported in NVMe.

nr_requests specifies the maximum number of read and write requests that can be queued at one time. The default value is 128, which means that 128 read requests and 128 write requests can be queued before the next process to request a read or write is put to sleep.

NVM Express is based on a paired Submission and Completion Queue mechanism. Commands are placed by host software into the Submission Queue. Completions are placed into an associated Completion Queue by the controller.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个问题可能是你想问的是 queue_delayed_work 函数,它是 Linux 内核中定义的一个函数,用于向工作队列中添加一个延迟工作(delayed work)。 queue_delayed_work 函数需要传入三个参数,分别是指向工作队列的指针、指向延迟工作的指针以及延迟时间。当指定的延迟时间到达后,内核会自动将指定的延迟工作添加到指定的工作队列中,等待执行。 下面是一个简单的示例: ```c #include <linux/delay.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/workqueue.h> MODULE_LICENSE("GPL"); // 定义工作队列 static struct workqueue_struct *my_wq; // 定义延迟工作结构体 static struct delayed_work my_work; // 延迟工作函数 static void work_handler(struct work_struct *work) { printk(KERN_INFO "Delayed work executed!\n"); } // 模块加载函数 static int __init my_module_init(void) { printk(KERN_INFO "Module loaded!\n"); // 创建工作队列 my_wq = create_workqueue("my_work_queue"); // 初始化延迟工作结构体 INIT_DELAYED_WORK(&my_work, work_handler); // 延迟5秒执行工作 queue_delayed_work(my_wq, &my_work, msecs_to_jiffies(5000)); return 0; } // 模块卸载函数 static void __exit my_module_exit(void) { // 取消延迟工作 cancel_delayed_work(&my_work); // 销毁工作队列 destroy_workqueue(my_wq); printk(KERN_INFO "Module unloaded!\n"); } module_init(my_module_init); module_exit(my_module_exit); ``` 在这个示例中,我们首先创建了一个名为my_wq的工作队列,然后定义了一个名为my_work的延迟工作结构体,并且定义了一个工作函数work_handler。在模块加载函数中,我们使用queue_delayed_work函数将my_work延迟5秒后添加到my_wq工作队列中。在模块卸载函数中,我们使用cancel_delayed_work函数取消my_work的执行,并且销毁了my_wq工作队列。当模块加载时,内核会输出"Delayed work executed!",表示延迟工作已经被执行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值