1
0

release 6.16.3 (preliminary)

This commit is contained in:
2025-08-25 00:14:57 +03:00
parent 86c5c0ef41
commit 44cb6acc9c
238 changed files with 10031 additions and 3060 deletions

View File

@@ -1,85 +0,0 @@
From bf57be2df6a113afba465bea635444764a7d0f11 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Thu, 19 May 2022 14:40:07 +0200
Subject: drivers/firmware: skip simpledrm if nvidia-drm.modeset=1 is set
The Nvidia proprietary driver has some bugs that leads to issues if used
with the simpledrm driver. The most noticeable is that does not register
an emulated fbdev device.
It just relies on a fbdev to be registered by another driver, that could
be that could be attached to the framebuffer console. On UEFI machines,
this is the efifb driver.
This means that disabling the efifb driver will cause virtual consoles to
not be present in the system when using the Nvidia driver. Legacy BIOS is
not affected just because fbcon is not used there, but instead vgacon.
Unless a VGA mode is specified using the vga= kernel command line option,
in that case the vesafb driver is used instead and its fbdev attached to
the fbcon.
This is a problem because with CONFIG_SYSFB_SIMPLEFB=y, the sysfb platform
code attempts to register a "simple-framebuffer" platform device (that is
matched against simpledrm) and only registers either an "efi-framebuffer"
or "vesa-framebuffer" if this fails to be registered due the video modes
not being compatible.
The Nvidia driver relying on another driver to register the fbdev is quite
fragile, since it can't really assume those will stick around. For example
there are patches posted to remove the EFI and VESA platform devices once
a real DRM or fbdev driver probes.
But in any case, moving to a simpledrm + emulated fbdev only breaks this
assumption and causes users to not have VT if the Nvidia driver is used.
So to prevent this, let's add a workaround and make the sysfb to skip the
"simple-framebuffer" registration when nvidia-drm.modeset=1 option is set.
This is quite horrible, but honestly I can't think of any other approach.
For this to work, the CONFIG_FB_EFI and CONFIG_FB_VESA config options must
be enabled besides CONFIG_DRM_SIMPLEDRM.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Source: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1788
Cherry-picked-for: https://bugs.archlinux.org/task/73720
Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/94
---
drivers/firmware/sysfb.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -35,6 +35,22 @@
#include <linux/screen_info.h>
#include <linux/sysfb.h>
+static int skip_simpledrm;
+
+static int __init simpledrm_disable(char *opt)
+{
+ if (!opt)
+ return -EINVAL;
+
+ get_option(&opt, &skip_simpledrm);
+
+ if (skip_simpledrm)
+ pr_info("The simpledrm driver will not be probed\n");
+
+ return 0;
+}
+early_param("nvidia-drm.modeset", simpledrm_disable);
+
static struct platform_device *pd;
static DEFINE_MUTEX(disable_lock);
static bool disabled;
@@ -165,7 +181,7 @@ static __init int sysfb_init(void)
/* try to create a simple-framebuffer device */
compatible = sysfb_parse_mode(si, &mode);
- if (compatible) {
+ if (compatible && !skip_simpledrm) {
pd = sysfb_create_simplefb(si, &mode, parent);
if (!IS_ERR(pd))
goto put_device;

View File

@@ -0,0 +1,107 @@
From f556624b84006d199f4e32314589fc3d1800e730 Mon Sep 17 00:00:00 2001
From: wangzijie <wangzijie1@honor.com>
Date: Mon, 18 Aug 2025 20:31:02 +0800
Subject: proc: fix missing pde_set_flags() for net proc files
To avoid potential UAF issues during module removal races, we use pde_set_flags()
to save proc_ops flags in PDE itself before proc_register(), and then use
pde_has_proc_*() helpers instead of directly dereferencing pde->proc_ops->*.
However, the pde_set_flags() call was missing when creating net related proc files.
This omission caused incorrect behavior which FMODE_LSEEK was being cleared
inappropriately in proc_reg_open() for net proc files. Lars reported it in this link[1].
Fix this by ensuring pde_set_flags() is called when register proc entry, and add
NULL check for proc_ops in pde_set_flags().
[1]: https://lore.kernel.org/all/20250815195616.64497967@chagall.paradoxon.rec/
Fixes: ff7ec8dc1b64 ("proc: use the same treatment to check proc_lseek as ones for proc_read_iter et.al)
Cc: stable@vger.kernel.org
Reported-by: Lars Wendler <polynomial-c@gmx.de>
Signed-off-by: wangzijie <wangzijie1@honor.com>
Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/151
---
fs/proc/generic.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -364,6 +364,23 @@ static const struct inode_operations pro
.setattr = proc_notify_change,
};
+static void pde_set_flags(struct proc_dir_entry *pde)
+{
+ if (!pde->proc_ops)
+ return;
+
+ if (pde->proc_ops->proc_flags & PROC_ENTRY_PERMANENT)
+ pde->flags |= PROC_ENTRY_PERMANENT;
+ if (pde->proc_ops->proc_read_iter)
+ pde->flags |= PROC_ENTRY_proc_read_iter;
+#ifdef CONFIG_COMPAT
+ if (pde->proc_ops->proc_compat_ioctl)
+ pde->flags |= PROC_ENTRY_proc_compat_ioctl;
+#endif
+ if (pde->proc_ops->proc_lseek)
+ pde->flags |= PROC_ENTRY_proc_lseek;
+}
+
/* returns the registered entry, or frees dp and returns NULL on failure */
struct proc_dir_entry *proc_register(struct proc_dir_entry *dir,
struct proc_dir_entry *dp)
@@ -371,6 +388,8 @@ struct proc_dir_entry *proc_register(str
if (proc_alloc_inum(&dp->low_ino))
goto out_free_entry;
+ pde_set_flags(dp);
+
write_lock(&proc_subdir_lock);
dp->parent = dir;
if (pde_subdir_insert(dir, dp) == false) {
@@ -559,20 +578,6 @@ struct proc_dir_entry *proc_create_reg(c
return p;
}
-static void pde_set_flags(struct proc_dir_entry *pde)
-{
- if (pde->proc_ops->proc_flags & PROC_ENTRY_PERMANENT)
- pde->flags |= PROC_ENTRY_PERMANENT;
- if (pde->proc_ops->proc_read_iter)
- pde->flags |= PROC_ENTRY_proc_read_iter;
-#ifdef CONFIG_COMPAT
- if (pde->proc_ops->proc_compat_ioctl)
- pde->flags |= PROC_ENTRY_proc_compat_ioctl;
-#endif
- if (pde->proc_ops->proc_lseek)
- pde->flags |= PROC_ENTRY_proc_lseek;
-}
-
struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
struct proc_dir_entry *parent,
const struct proc_ops *proc_ops, void *data)
@@ -583,7 +588,6 @@ struct proc_dir_entry *proc_create_data(
if (!p)
return NULL;
p->proc_ops = proc_ops;
- pde_set_flags(p);
return proc_register(parent, p);
}
EXPORT_SYMBOL(proc_create_data);
@@ -634,7 +638,6 @@ struct proc_dir_entry *proc_create_seq_p
p->proc_ops = &proc_seq_ops;
p->seq_ops = ops;
p->state_size = state_size;
- pde_set_flags(p);
return proc_register(parent, p);
}
EXPORT_SYMBOL(proc_create_seq_private);
@@ -665,7 +668,6 @@ struct proc_dir_entry *proc_create_singl
return NULL;
p->proc_ops = &proc_single_ops;
p->single_show = show;
- pde_set_flags(p);
return proc_register(parent, p);
}
EXPORT_SYMBOL(proc_create_single_data);

View File

@@ -1,4 +1,4 @@
From eceae849a8242fcfeec64470f6f4c24fbae0d614 Mon Sep 17 00:00:00 2001
From fff64147d7411e03ec87ec1f9716fe5795dbdfd1 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Mon, 26 Apr 2021 22:12:46 +0200
Subject: ZEN: Add VHBA driver
@@ -18,7 +18,7 @@ tag vhba-module-20250329
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1521,4 +1521,6 @@ endif # SCSI_LOWLEVEL
@@ -1524,4 +1524,6 @@ endif # SCSI_LOWLEVEL
source "drivers/scsi/device_handler/Kconfig"

View File

@@ -1,4 +1,4 @@
From e0d21c7f4ea5f33bb4a6076d8ff50ad19431e333 Mon Sep 17 00:00:00 2001
From 8f7dbc1fba107ae9369d57f037f876f3ca69e910 Mon Sep 17 00:00:00 2001
From: Daniel Drake <drake@endlessm.com>
Date: Tue, 4 Jun 2019 14:51:21 +0800
Subject: ZEN: PCI: Add Intel remapped NVMe device support
@@ -94,7 +94,7 @@ Contains:
-#endif
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1662,7 +1662,7 @@ static irqreturn_t ahci_thunderx_irq_han
@@ -1656,7 +1656,7 @@ static irqreturn_t ahci_thunderx_irq_han
}
#endif
@@ -103,7 +103,7 @@ Contains:
struct ahci_host_priv *hpriv)
{
int i;
@@ -1675,7 +1675,7 @@ static void ahci_remap_check(struct pci_
@@ -1669,7 +1669,7 @@ static void ahci_remap_check(struct pci_
pci_resource_len(pdev, bar) < SZ_512K ||
bar != AHCI_PCI_BAR_STANDARD ||
!(readl(hpriv->mmio + AHCI_VSCAP) & 1))
@@ -112,7 +112,7 @@ Contains:
cap = readq(hpriv->mmio + AHCI_REMAP_CAP);
for (i = 0; i < AHCI_MAX_REMAP; i++) {
@@ -1690,18 +1690,11 @@ static void ahci_remap_check(struct pci_
@@ -1684,18 +1684,11 @@ static void ahci_remap_check(struct pci_
}
if (!hpriv->remapped_nvme)
@@ -135,7 +135,7 @@ Contains:
}
static int ahci_get_irq_vector(struct ata_host *host, int port)
@@ -1955,7 +1948,9 @@ static int ahci_init_one(struct pci_dev
@@ -1949,7 +1942,9 @@ static int ahci_init_one(struct pci_dev
return -ENOMEM;
/* detect remapped nvme devices */

View File

@@ -1,4 +1,4 @@
From 490a2fd553b92e5ad5f151994a9bbf953cc000f7 Mon Sep 17 00:00:00 2001
From bc4a77fd53959912f1cc2a866f5d4be640ce5211 Mon Sep 17 00:00:00 2001
From: Sultan Alsawaf <sultan@kerneltoast.com>
Date: Sun, 8 Mar 2020 00:31:35 -0800
Subject: ZEN: Disable stack conservation for GCC
@@ -15,7 +15,7 @@ Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
--- a/Makefile
+++ b/Makefile
@@ -1076,11 +1076,6 @@ KBUILD_CFLAGS += -fno-strict-overflow
@@ -1088,11 +1088,6 @@ KBUILD_CFLAGS += -fno-strict-overflow
# Make sure -fstack-check isn't enabled (like gentoo apparently did)
KBUILD_CFLAGS += -fno-stack-check

View File

@@ -1,4 +1,4 @@
From 71ce760cd36faae55cc0fefebed49998b5eae864 Mon Sep 17 00:00:00 2001
From f6ed65cd7bda9cb6009c6a12efd7c4311df31936 Mon Sep 17 00:00:00 2001
From: Kenny Levinsen <kl@kl.wtf>
Date: Sun, 27 Dec 2020 14:43:13 +0000
Subject: ZEN: Input: evdev - use call_rcu when detaching client

View File

@@ -0,0 +1,49 @@
From 8b27c81fbddbde60634661baeb1fd475de32355b Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Thu, 22 May 2025 07:32:13 +0200
Subject: ZEN: Add config for default of unprivileged_userns_clone
---
init/Kconfig | 16 ++++++++++++++++
kernel/user_namespace.c | 4 ++++
2 files changed, 20 insertions(+)
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1349,6 +1349,22 @@ config USER_NS
If unsure, say N.
+config USER_NS_UNPRIVILEGED
+ bool "Allow unprivileged users to create namespaces"
+ default y
+ depends on USER_NS
+ help
+ When disabled, unprivileged users will not be able to create
+ new namespaces. Allowing users to create their own namespaces
+ has been part of several recent local privilege escalation
+ exploits, so if you need user namespaces but are
+ paranoid^Wsecurity-conscious you want to disable this.
+
+ This setting can be overridden at runtime via the
+ kernel.unprivileged_userns_clone sysctl.
+
+ If unsure, say Y.
+
config PID_NS
bool "PID Namespaces"
default y
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -23,7 +23,11 @@
#include <linux/sort.h>
/* sysctl */
+#ifdef CONFIG_USER_NS_UNPRIVILEGED
int unprivileged_userns_clone = 1;
+#else
+int unprivileged_userns_clone;
+#endif
static struct kmem_cache *user_ns_cachep __ro_after_init;
static DEFINE_MUTEX(userns_state_mutex);

View File

@@ -1,4 +1,4 @@
From 45cea9e15f2512535f2836ccddcf711f4823a2e1 Mon Sep 17 00:00:00 2001
From cab7ea1a4ef6685a133ae121ca27098b9dd31287 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Mon, 11 Jul 2022 19:10:30 -0500
Subject: ZEN: cpufreq: Remove schedutil dependency on Intel/AMD P-State

View File

@@ -1,4 +1,4 @@
From c5eb62bb4d6a06a5a95c0da0d41469f22e71556f Mon Sep 17 00:00:00 2001
From 3d7d0f26977a6d4f6bff2edb4e6388da83789e87 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Wed, 15 Jan 2020 20:43:56 -0600
Subject: ZEN: intel-pstate: Implement "enable" parameter
@@ -30,7 +30,7 @@ selection.
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2324,6 +2324,9 @@
@@ -2342,6 +2342,9 @@
disable
Do not enable intel_pstate as the default
scaling driver for the supported processors
@@ -42,7 +42,7 @@ selection.
governors layer of cpufreq and provides it own
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -3830,6 +3830,8 @@ static int __init intel_pstate_setup(cha
@@ -3949,6 +3949,8 @@ static int __init intel_pstate_setup(cha
if (!strcmp(str, "disable"))
no_load = 1;

View File

@@ -1,4 +1,4 @@
From b42cd00b809a2f69bbf5e1d63cb7ff90f5f51410 Mon Sep 17 00:00:00 2001
From db369c984b7e14f64054fe756c156f2c04b3227a Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Fri, 15 Mar 2024 12:36:51 -0500
Subject: ZEN: drm/amdgpu/pm: Allow override of min_power_limit with
@@ -13,7 +13,7 @@ Subject: ZEN: drm/amdgpu/pm: Allow override of min_power_limit with
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -161,6 +161,7 @@ struct amdgpu_watchdog_timer {
@@ -163,6 +163,7 @@ struct amdgpu_watchdog_timer {
*/
extern int amdgpu_modeset;
extern unsigned int amdgpu_vram_limit;
@@ -23,7 +23,7 @@ Subject: ZEN: drm/amdgpu/pm: Allow override of min_power_limit with
extern int amdgpu_gtt_size;
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -143,6 +143,7 @@ enum AMDGPU_DEBUG_MASK {
@@ -147,6 +147,7 @@ enum AMDGPU_DEBUG_MASK {
};
unsigned int amdgpu_vram_limit = UINT_MAX;
@@ -31,7 +31,7 @@ Subject: ZEN: drm/amdgpu/pm: Allow override of min_power_limit with
int amdgpu_vis_vram_limit;
int amdgpu_gart_size = -1; /* auto */
int amdgpu_gtt_size = -1; /* auto */
@@ -263,6 +264,15 @@ struct amdgpu_watchdog_timer amdgpu_watc
@@ -269,6 +270,15 @@ struct amdgpu_watchdog_timer amdgpu_watc
};
/**
@@ -49,7 +49,7 @@ Subject: ZEN: drm/amdgpu/pm: Allow override of min_power_limit with
*/
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -3057,6 +3057,9 @@ static ssize_t amdgpu_hwmon_show_power_c
@@ -3073,6 +3073,9 @@ static ssize_t amdgpu_hwmon_show_power_c
struct device_attribute *attr,
char *buf)
{

View File

@@ -1,4 +1,4 @@
From fe26e658b0a14ba9ab4f800bea6a7a43aae0981e Mon Sep 17 00:00:00 2001
From 77ad4ad132593a5838fa42942f190a1586d166fd Mon Sep 17 00:00:00 2001
From: Sultan Alsawaf <sultan@kerneltoast.com>
Date: Sun, 19 Apr 2020 19:59:18 -0700
Subject: ZEN: mm: Stop kswapd early when nothing's waiting for it to free
@@ -43,7 +43,7 @@ Contains:
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -788,6 +788,7 @@ void post_alloc_hook(struct page *page,
@@ -791,6 +791,7 @@ void post_alloc_hook(struct page *page,
extern bool free_pages_prepare(struct page *page, unsigned int order);
extern int user_min_free_kbytes;
@@ -62,7 +62,7 @@ Contains:
/* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */
static DEFINE_MUTEX(pcp_batch_high_lock);
#define MIN_PERCPU_PAGELIST_HIGH_FRACTION (8)
@@ -4432,6 +4434,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u
@@ -4421,6 +4423,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u
unsigned int cpuset_mems_cookie;
unsigned int zonelist_iter_cookie;
int reserve_flags;
@@ -70,7 +70,7 @@ Contains:
if (unlikely(nofail)) {
/*
@@ -4491,8 +4494,13 @@ restart:
@@ -4480,8 +4483,13 @@ restart:
goto nopage;
}
@@ -85,7 +85,7 @@ Contains:
/*
* The adjusted alloc_flags might result in immediate success, so try
@@ -4707,9 +4715,12 @@ nopage:
@@ -4696,9 +4704,12 @@ nopage:
goto retry;
}
fail:
@@ -102,7 +102,7 @@ Contains:
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -6427,7 +6427,7 @@ retry:
@@ -6471,7 +6471,7 @@ retry:
return 0;
}
@@ -111,7 +111,7 @@ Contains:
{
struct zone *zone;
unsigned long pfmemalloc_reserve = 0;
@@ -6452,6 +6452,10 @@ static bool allow_direct_reclaim(pg_data
@@ -6496,6 +6496,10 @@ static bool allow_direct_reclaim(pg_data
wmark_ok = free_pages > pfmemalloc_reserve / 2;
@@ -122,7 +122,7 @@ Contains:
/* kswapd must be awake if processes are being throttled */
if (!wmark_ok && waitqueue_active(&pgdat->kswapd_wait)) {
if (READ_ONCE(pgdat->kswapd_highest_zoneidx) > ZONE_NORMAL)
@@ -6517,7 +6521,7 @@ static bool throttle_direct_reclaim(gfp_
@@ -6561,7 +6565,7 @@ static bool throttle_direct_reclaim(gfp_
/* Throttle based on the first usable node */
pgdat = zone->zone_pgdat;
@@ -131,7 +131,7 @@ Contains:
goto out;
break;
}
@@ -6539,11 +6543,14 @@ static bool throttle_direct_reclaim(gfp_
@@ -6583,11 +6587,14 @@ static bool throttle_direct_reclaim(gfp_
*/
if (!(gfp_mask & __GFP_FS))
wait_event_interruptible_timeout(pgdat->pfmemalloc_wait,
@@ -148,7 +148,7 @@ Contains:
if (fatal_signal_pending(current))
return true;
@@ -7064,14 +7071,14 @@ restart:
@@ -7108,14 +7115,14 @@ restart:
* able to safely make forward progress. Wake them
*/
if (waitqueue_active(&pgdat->pfmemalloc_wait) &&

View File

@@ -1,4 +1,4 @@
From bc6ff8d7a55a19fdd6828168cc35cba76f05c133 Mon Sep 17 00:00:00 2001
From 5aa2c66fd59f226e8bbda0aa5628970d38cb2aa4 Mon Sep 17 00:00:00 2001
From: EXtremeExploit <pedro.montes.alcalde@gmail.com>
Date: Fri, 29 Nov 2024 13:05:27 -0300
Subject: ZEN: ahci: Disable staggered spinup by default

View File

@@ -1,4 +1,4 @@
From 4ae0eb6d9a78f53d796996b17743b7df74a7f43d Mon Sep 17 00:00:00 2001
From f7340c5dabce15dd3285d340f952cfb7fb396344 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Sat, 14 Dec 2024 11:23:18 -0600
Subject: ZEN: kernel/Kconfig.preempt: Remove EXPERT conditional on PREEMPT_RT

View File

@@ -1,4 +1,4 @@
From e90e4b57fedca27f5c230f39bd6f67672f1d24ef Mon Sep 17 00:00:00 2001
From fb5c79d96cc87e4778ac0f2a53bc7c0c23078c54 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 27 Jan 2020 18:10:06 +0100
Subject: ZEN: INTERACTIVE: Base config item
@@ -9,7 +9,7 @@ Subject: ZEN: INTERACTIVE: Base config item
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -163,6 +163,12 @@ config THREAD_INFO_IN_TASK
@@ -167,6 +167,12 @@ config THREAD_INFO_IN_TASK
menu "General setup"

View File

@@ -1,4 +1,4 @@
From 4da290d83614efedb0eb3b8114070fbddc46677b Mon Sep 17 00:00:00 2001
From 208f2c37cff2a2bde18adcdd79274254e03fac8d Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 27 Jan 2020 18:11:05 +0100
Subject: ZEN: INTERACTIVE: Use BFQ as the elevator for SQ devices
@@ -10,21 +10,21 @@ Subject: ZEN: INTERACTIVE: Use BFQ as the elevator for SQ devices
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -560,7 +560,11 @@ static struct elevator_type *elevator_ge
!blk_mq_is_shared_tags(q->tag_set->flags))
return NULL;
@@ -716,7 +716,11 @@ void elv_update_nr_hw_queues(struct requ
void elevator_set_default(struct request_queue *q)
{
struct elv_change_ctx ctx = {
+#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_IOSCHED_BFQ)
+ return elevator_find_get("bfq");
+ .name = "bfq",
+#else
return elevator_find_get("mq-deadline");
.name = "mq-deadline",
+#endif
}
/*
.no_uevent = true,
};
int err;
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -169,6 +169,10 @@ config ZEN_INTERACTIVE
@@ -173,6 +173,10 @@ config ZEN_INTERACTIVE
help
Tunes the kernel for responsiveness at the cost of throughput and power usage.

View File

@@ -0,0 +1,39 @@
From 9d0d6a80618eca3c985f2307971455d6c8ae9fe7 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 2 Aug 2025 04:36:06 +0200
Subject: block: Clean up elevator_set_default
In case of a multi-queue device, the code pointlessly loaded the
default elevator just to drop it again.
---
block/elevator.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -737,17 +737,18 @@ void elevator_set_default(struct request
* have multiple queues or mq-deadline is not available, default
* to "none".
*/
+ if (q->nr_hw_queues != 1 && !blk_mq_is_shared_tags(q->tag_set->flags))
+ return;
+
e = elevator_find_get(ctx.name);
if (!e)
return;
- if ((q->nr_hw_queues == 1 ||
- blk_mq_is_shared_tags(q->tag_set->flags))) {
- err = elevator_change(q, &ctx);
- if (err < 0)
- pr_warn("\"%s\" elevator initialization, failed %d, falling back to \"none\"\n",
- ctx.name, err);
- }
+ err = elevator_change(q, &ctx);
+ if (err < 0)
+ pr_warn("\"%s\" elevator initialization, failed %d, falling back to \"none\"\n",
+ ctx.name, err);
+
elevator_put(e);
}

View File

@@ -1,4 +1,4 @@
From 1689e70d72aff7c4e26ca326e5e94b2d244d13bd Mon Sep 17 00:00:00 2001
From 0f5c2376123a8592d9b05167327c67e4cd5e1564 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Mon, 12 Dec 2022 00:03:03 +0100
Subject: ZEN: INTERACTIVE: Use Kyber as the elevator for MQ devices
@@ -10,23 +10,23 @@ Subject: ZEN: INTERACTIVE: Use Kyber as the elevator for MQ devices
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -558,7 +558,13 @@ static struct elevator_type *elevator_ge
if (q->nr_hw_queues != 1 &&
!blk_mq_is_shared_tags(q->tag_set->flags))
@@ -738,7 +738,13 @@ void elevator_set_default(struct request
* to "none".
*/
if (q->nr_hw_queues != 1 && !blk_mq_is_shared_tags(q->tag_set->flags))
+#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_MQ_IOSCHED_KYBER)
+ return elevator_find_get("kyber");
+ ctx.name = "kyber";
+#elif defined(CONFIG_ZEN_INTERACTIVE)
+ return elevator_find_get("mq-deadline");
+ ctx.name = "mq-deadline";
+#else
return NULL;
return;
+#endif
#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_IOSCHED_BFQ)
return elevator_find_get("bfq");
e = elevator_find_get(ctx.name);
if (!e)
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -172,6 +172,7 @@ config ZEN_INTERACTIVE
@@ -176,6 +176,7 @@ config ZEN_INTERACTIVE
--- Block Layer ----------------------------------------
Default scheduler for SQ..: mq-deadline -> bfq

View File

@@ -1,4 +1,4 @@
From 8ae9125b5d9637f6b97d20f71348c3e67322028b Mon Sep 17 00:00:00 2001
From 21dd0495958b7c1bd34f2d83537a4f3af5b804c3 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 27 Jan 2020 18:21:09 +0100
Subject: ZEN: INTERACTIVE: Enable background reclaim of hugepages
@@ -32,7 +32,7 @@ Reasoning and details in the original patch: https://lwn.net/Articles/711248/
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -174,6 +174,10 @@ config ZEN_INTERACTIVE
@@ -178,6 +178,10 @@ config ZEN_INTERACTIVE
Default scheduler for SQ..: mq-deadline -> bfq
Default scheduler for MQ..: none -> kyber

View File

@@ -1,4 +1,4 @@
From 93c14f60cef3fe7aa8d11edcab2d9a994b667087 Mon Sep 17 00:00:00 2001
From 413db39ffc2d95bf43fa5690cbf6300f5d5e45bd Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Tue, 31 Oct 2023 19:03:10 +0100
Subject: ZEN: INTERACTIVE: Tune EEVDF for interactivity
@@ -42,7 +42,7 @@ caused by rebalancing too many tasks at once.
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -178,6 +178,13 @@ config ZEN_INTERACTIVE
@@ -182,6 +182,13 @@ config ZEN_INTERACTIVE
Background-reclaim hugepages...: no -> yes
@@ -93,7 +93,7 @@ caused by rebalancing too many tasks at once.
/* Restrict the NUMA promotion throughput (MB/s) for each target node. */
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2790,7 +2790,7 @@ extern void deactivate_task(struct rq *r
@@ -2816,7 +2816,7 @@ extern void deactivate_task(struct rq *r
extern void wakeup_preempt(struct rq *rq, struct task_struct *p, int flags);

View File

@@ -1,4 +1,4 @@
From 06211fa595081b33d5de6d818f5d370055075cb2 Mon Sep 17 00:00:00 2001
From eb785518e63a468a6825aca26ca5de7dc1368a3a Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 27 Jan 2020 18:27:16 +0100
Subject: ZEN: INTERACTIVE: Tune ondemand governor for interactivity
@@ -65,7 +65,7 @@ Remove MuQSS cpufreq configuration.
+#define DEF_SAMPLING_DOWN_FACTOR (5)
+#else
#define DEF_FREQUENCY_UP_THRESHOLD (63)
+#define MICRO_FREQUENCY_UP_THRESHOLD (70)
+#define MICRO_FREQUENCY_UP_THRESHOLD (95)
#define DEF_SAMPLING_DOWN_FACTOR (100)
+#endif
#define MAX_SAMPLING_DOWN_FACTOR (100000)
@@ -75,7 +75,7 @@ Remove MuQSS cpufreq configuration.
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -185,6 +185,12 @@ config ZEN_INTERACTIVE
@@ -189,6 +189,12 @@ config ZEN_INTERACTIVE
Bandwidth slice size...........: 5 -> 3 ms
Task rebalancing threshold.....: 32 -> 8

View File

@@ -1,4 +1,4 @@
From a79294bd643ed6b143fc76ddfdeb25caa2121aa4 Mon Sep 17 00:00:00 2001
From b418708702f7927a7922b90871ab1cdf1df9bb94 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Sat, 5 Mar 2022 11:37:14 -0600
Subject: ZEN: INTERACTIVE: mm: Disable unevictable compaction
@@ -12,7 +12,7 @@ turn it off when CONFIG_ZEN_INTERACTIVE is set as well.
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -177,6 +177,7 @@ config ZEN_INTERACTIVE
@@ -181,6 +181,7 @@ config ZEN_INTERACTIVE
--- Virtual Memory Subsystem ---------------------------
Background-reclaim hugepages...: no -> yes
@@ -22,7 +22,7 @@ turn it off when CONFIG_ZEN_INTERACTIVE is set as well.
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -654,7 +654,7 @@ config COMPACTION
@@ -658,7 +658,7 @@ config COMPACTION
config COMPACT_UNEVICTABLE_DEFAULT
int
depends on COMPACTION

View File

@@ -1,57 +0,0 @@
From faa505ee52add9101fc9701edc9567e7f7a254df Mon Sep 17 00:00:00 2001
From: Sultan Alsawaf <sultan@kerneltoast.com>
Date: Wed, 20 Oct 2021 20:50:11 -0700
Subject: ZEN: INTERACTIVE: mm: Lower the non-hugetlbpage pageblock size to
reduce scheduling delays
The page allocator processes free pages in groups of pageblocks, where
the size of a pageblock is typically quite large (1024 pages without
hugetlbpage support). Pageblocks are processed atomically with the zone
lock held, which can cause severe scheduling delays on both the CPU
going through the pageblock and any other CPUs waiting to acquire the
zone lock. A frequent offender is move_freepages_block(), which is used
by rmqueue() for page allocation.
As it turns out, there's no requirement for pageblocks to be so large,
so the pageblock order can simply be reduced to ease the scheduling
delays and zone lock contention. PAGE_ALLOC_COSTLY_ORDER is used as a
reasonable setting to ensure non-costly page allocation requests can
still be serviced without always needing to free up more than one
pageblock's worth of pages at a time.
This has a noticeable effect on overall system latency when memory
pressure is elevated. The various mm functions which operate on
pageblocks no longer appear in the preemptoff tracer, where previously
they would spend up to 100 ms on a mobile arm64 CPU processing a
pageblock with preemption disabled and the zone lock held.
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
---
include/linux/pageblock-flags.h | 4 ++++
init/Kconfig | 1 +
2 files changed, 5 insertions(+)
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -52,7 +52,11 @@ extern unsigned int pageblock_order;
#else /* CONFIG_TRANSPARENT_HUGEPAGE */
/* If huge pages are not used, group by MAX_ORDER_NR_PAGES */
+#ifdef CONFIG_ZEN_INTERACTIVE
+#define pageblock_order PAGE_ALLOC_COSTLY_ORDER
+#else
#define pageblock_order MAX_PAGE_ORDER
+#endif
#endif /* CONFIG_HUGETLB_PAGE */
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -179,6 +179,7 @@ config ZEN_INTERACTIVE
Background-reclaim hugepages...: no -> yes
Compact unevictable............: yes -> no
Watermark boost factor.........: 1.5 -> 0
+ Pageblock order................: 10 -> 3
--- EEVDF CPU Scheduler --------------------------------

View File

@@ -1,44 +0,0 @@
From 8114de0815b1821e66951288e0a14c5a13b68d82 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Sat, 21 May 2022 15:15:09 -0500
Subject: ZEN: INTERACTIVE: dm-crypt: Disable workqueues for crypto ops
Queueing in dm-crypt for crypto operations reduces performance on modern
systems. As discussed in an article from Cloudflare, they discovered
that queuing was introduced because the crypto subsystem used to be
synchronous. Since it's now asynchronous, we get double queueing when
using the subsystem through dm-crypt. This is obviously undesirable and
reduces throughput and increases latency.
Disable queueing when using our Zen Interactive configuration.
Fixes: https://github.com/zen-kernel/zen-kernel/issues/282
---
drivers/md/dm-crypt.c | 5 +++++
init/Kconfig | 1 +
2 files changed, 6 insertions(+)
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3284,6 +3284,11 @@ static int crypt_ctr(struct dm_target *t
goto bad;
}
+#ifdef CONFIG_ZEN_INTERACTIVE
+ set_bit(DM_CRYPT_NO_READ_WORKQUEUE, &cc->flags);
+ set_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags);
+#endif
+
ret = crypt_ctr_cipher(ti, argv[0], argv[1]);
if (ret < 0)
goto bad;
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -173,6 +173,7 @@ config ZEN_INTERACTIVE
Default scheduler for SQ..: mq-deadline -> bfq
Default scheduler for MQ..: none -> kyber
+ DM-Crypt workqueues.......: yes -> no
--- Virtual Memory Subsystem ---------------------------

View File

@@ -1,4 +1,4 @@
From d7c684733ae88876fb00899c621dd40e08902f1e Mon Sep 17 00:00:00 2001
From 92850f57d0d3dd0c55a6556f4c4a9afd38da7f8a Mon Sep 17 00:00:00 2001
From: Sultan Alsawaf <sultan@kerneltoast.com>
Date: Sat, 28 Mar 2020 13:06:28 -0700
Subject: ZEN: INTERACTIVE: mm: Disable watermark boosting by default
@@ -33,7 +33,7 @@ Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -178,6 +178,7 @@ config ZEN_INTERACTIVE
@@ -182,6 +182,7 @@ config ZEN_INTERACTIVE
Background-reclaim hugepages...: no -> yes
Compact unevictable............: yes -> no

View File

@@ -1,4 +1,4 @@
From 1bc3828fcd5966dd94126355e4d02e42caf1407b Mon Sep 17 00:00:00 2001
From e3afdec765f5277bbd3b2196e0facb8b428fb9d2 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Mon, 5 Sep 2022 11:35:20 -0500
Subject: ZEN: INTERACTIVE: mm/swap: Disable swap-in readahead
@@ -20,10 +20,10 @@ same change so Zen Kernel users benefit.
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -181,6 +181,7 @@ config ZEN_INTERACTIVE
@@ -183,6 +183,7 @@ config ZEN_INTERACTIVE
Background-reclaim hugepages...: no -> yes
Compact unevictable............: yes -> no
Watermark boost factor.........: 1.5 -> 0
Pageblock order................: 10 -> 3
+ Swap-in readahead..............: 3 -> 0
--- EEVDF CPU Scheduler --------------------------------

View File

@@ -1,4 +1,4 @@
From 625fb48c0c4fab13b9c2f231c3fe6368a1b78242 Mon Sep 17 00:00:00 2001
From c7afc157454cc7f09bc57eadf2efed6fb7fd006d Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Sun, 19 Sep 2021 16:03:36 -0500
Subject: ZEN: INTERACTIVE: Document PDS/BMQ configuration
@@ -9,7 +9,7 @@ Subject: ZEN: INTERACTIVE: Document PDS/BMQ configuration
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -190,6 +190,11 @@ config ZEN_INTERACTIVE
@@ -192,6 +192,11 @@ config ZEN_INTERACTIVE
Bandwidth slice size...........: 5 -> 3 ms
Task rebalancing threshold.....: 32 -> 8

View File

@@ -0,0 +1,25 @@
From 08d11019f3924f192e1a68d7d2007f8ec7bdf889 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sun, 3 Aug 2025 15:27:26 +0200
Subject: squash! ZEN: INTERACTIVE: Use Kyber as the elevator for MQ devices
Fall back straight to none instead of mq-deadline. Some benchmarks in a
[recent paper][1] suggest that mq-deadline has too much lock contention,
hurting throughput and eating CPU waiting for spinlocks.
[1]: https://research.spec.org/icpe_proceedings/2024/proceedings/p154.pdf
---
block/elevator.c | 2 --
1 file changed, 2 deletions(-)
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -740,8 +740,6 @@ void elevator_set_default(struct request
if (q->nr_hw_queues != 1 && !blk_mq_is_shared_tags(q->tag_set->flags))
#if defined(CONFIG_ZEN_INTERACTIVE) && defined(CONFIG_MQ_IOSCHED_KYBER)
ctx.name = "kyber";
-#elif defined(CONFIG_ZEN_INTERACTIVE)
- ctx.name = "mq-deadline";
#else
return;
#endif