How to set the disk IO scheduler in RHEL9?
Environment
- Red Hat Enterprise Linux 9
- Kernel parameter
elevator
Issue
-
How to set the disk IO scheduler in RHEL9?
-
Booting the RHEL9 system with the kernel boot parameter
elevatorprints the following warning message.kernel: Kernel parameter elevator= does not have any effect anymore. Please use sysfs to set IO scheduler for individual devices.
Resolution
- The kernel selects a default disk IO scheduler based on the type of device. This is typically the optimal setting.
- If you require a different scheduler, Red Hat recommends that you use
udevrules or theTunedservice to configure it.
Root Cause
-
In Red Hat Enterprise Linux 9, block devices support only
multi-queuescheduling. This enables the block layer performance to scale well with fast solid-state drives (SSDs) and multi-core systems. -
The
elevatorkernel command line parameter was used in earlier RHEL releases to set the disk scheduler for all devices. In RHEL 8/9, the parameter is deprecated. -
The upstream Linux kernel has removed support for the kernel boot parameter
elevatorto set an IO scheduler globally.$ git show 85c0a037dc7a1a34d6add49d6eaa2deddbf43d7b commit 85c0a037dc7a1a34d6add49d6eaa2deddbf43d7b Author: Marcos Paulo de Souza <marcos.souza.org@gmail.com> Date: Tue Aug 27 22:19:27 2019 -0300 block: elevator.c: Remove now unused elevator= argument Since the inclusion of blk-mq, elevator argument was not being considered anymore, and it's utility died long with the legacy IO path, now removed too. Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Bob Liu <bob.liu@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com> Fold with doc removal patch. Signed-off-by: Jens Axboe <axboe@kernel.dk> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 7ccd158b3894..8e68e8188751 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1197,12 +1197,6 @@ See comment before function elanfreq_setup() in arch/x86/kernel/cpu/cpufreq/elanfreq.c. - elevator= [IOSCHED] - Format: { "mq-deadline" | "kyber" | "bfq" } - See Documentation/block/deadline-iosched.rst, - Documentation/block/kyber-iosched.rst and - Documentation/block/bfq-iosched.rst for details. - elfcorehdr=[size[KMG]@]offset[KMG] [IA64,PPC,SH,X86,S390] Specifies physical address of start of kernel core image elf header and optionally the size. Generally diff --git a/block/elevator.c b/block/elevator.c index 4781c4205a5d..86100de88883 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -135,20 +135,6 @@ static struct elevator_type *elevator_get(struct request_queue *q, return e; } -static char chosen_elevator[ELV_NAME_MAX]; - -static int __init elevator_setup(char *str) -{ - /* - * Be backwards-compatible with previous kernels, so users - * won't get the wrong elevator. - */ - strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1); - return 1; -} - -__setup("elevator=", elevator_setup); - static struct kobj_type elv_ktype; struct elevator_queue *elevator_alloc(struct request_queue *q, -
The kernel prints a warning message when the kernel boot parameter
elevatoris used.$ git show f8db383507d658c5a729b062c97710efda876cd4 commit f8db383507d658c5a729b062c97710efda876cd4 Author: Jan Kara <jack@suse.cz> Date: Wed Nov 6 11:48:57 2019 +0100 block: Warn if elevator= parameter is used With transition to blk-mq, the elevator= kernel argument was removed as it makes less and less sense with the current variety of devices. Since this may surprise some users and there are advices on the Internet that still suggest to use it, let's at least warn if the parameter is used. Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk> diff --git a/block/elevator.c b/block/elevator.c index 5437059c9261..0b1db9afb586 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -831,3 +831,12 @@ struct request *elv_rb_latter_request(struct request_queue *q, return NULL; } EXPORT_SYMBOL(elv_rb_latter_request); + +static int __init elevator_setup(char *str) +{ + pr_warn("Kernel parameter elevator= does not have any effect anymore.\n" + "Please use sysfs to set IO scheduler for individual devices.\n"); + return 1; +} + +__setup("elevator=", elevator_setup);
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.