diff options
Diffstat (limited to 'modules/system/kernel')
-rw-r--r-- | modules/system/kernel/bfq/bfq-by-default.patch | 13 | ||||
-rw-r--r-- | modules/system/kernel/bfq/default.nix | 30 |
2 files changed, 43 insertions, 0 deletions
diff --git a/modules/system/kernel/bfq/bfq-by-default.patch b/modules/system/kernel/bfq/bfq-by-default.patch new file mode 100644 index 00000000..c6ee0492 --- /dev/null +++ b/modules/system/kernel/bfq/bfq-by-default.patch @@ -0,0 +1,13 @@ +diff --git a/block/elevator.c b/block/elevator.c +index dac99fbfc273..fbcdba53a3aa 100644 +--- a/block/elevator.c ++++ b/block/elevator.c +@@ -229,7 +229,7 @@ int elevator_init(struct request_queue *q, char *name) + */ + if (q->mq_ops) { + if (q->nr_hw_queues == 1) +- e = elevator_get("mq-deadline", false); ++ e = elevator_get("bfq", false); + if (!e) + return 0; + } else diff --git a/modules/system/kernel/bfq/default.nix b/modules/system/kernel/bfq/default.nix new file mode 100644 index 00000000..064179cf --- /dev/null +++ b/modules/system/kernel/bfq/default.nix @@ -0,0 +1,30 @@ +{ config, lib, ... }: + +{ + options.vuizvui.system.kernel.bfq = { + enable = lib.mkEnableOption "Enable the BFQ scheduler by default"; + }; + + config = lib.mkIf config.vuizvui.system.kernel.bfq.enable { + boot.kernelPatches = lib.singleton { + name = "bfq"; + patch = ./bfq-by-default.patch; + extraConfig = '' + SCSI_MQ_DEFAULT y + DM_MQ_DEFAULT y + IOSCHED_BFQ y + BFQ_GROUP_IOSCHED y + ''; + }; + + vuizvui.requiresTests = lib.singleton ["vuizvui" "system" "kernel" "bfq"]; + + assertions = lib.singleton { + assertion = + lib.versionAtLeast config.boot.kernelPackages.kernel.version "4.12"; + + message = "The BFQ scheduler in conjunction with blk-mq requires " + + "at least kernel 4.12."; + }; + }; +} |