git: 058ce52660fb - main - LinuxKPI: add system_percpu_wq

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 13 Jul 2026 14:59:19 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=058ce52660fb52ada41462d339fb1ce6aca48cf3

commit 058ce52660fb52ada41462d339fb1ce6aca48cf3
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-01-21 13:53:34 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-07-13 14:58:23 +0000

    LinuxKPI: add system_percpu_wq
    
    In Linux v6.17 system_wq was replaced (renamed to) system_percpu_wq,
    with the old name still present.
    
    We just alias system_percpu_wq to linux_system_short_wq like we do
    for system_wq to keep both around for the forseeable future.
    
    Note: the original system_wq was a per-cpu queue upstream as well
    based on my understanding but we never implemented it as such.
    That means we are still lacking a per-cpu implementation for
    system_percpu_wq but at least we do not change the status-quo
    of the LinuxKPI implementation with this.
    
    Note2: we should add a check somewhere for LINUXKPI_VESION >=
    61700 to print a warning if anyone still uses the system_wq
    to detect any possible sami-native or out-of-tree drivers
    relying on this and not properly updating.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    dumbbell; emaste (comments on previous review)
    Differential Revision: https://reviews.freebsd.org/D57730
---
 sys/compat/linuxkpi/common/include/linux/workqueue.h | 1 +
 sys/compat/linuxkpi/common/src/linux_work.c          | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/workqueue.h b/sys/compat/linuxkpi/common/include/linux/workqueue.h
index 66d3981d4229..b531d4f34658 100644
--- a/sys/compat/linuxkpi/common/include/linux/workqueue.h
+++ b/sys/compat/linuxkpi/common/include/linux/workqueue.h
@@ -237,6 +237,7 @@ extern struct workqueue_struct *system_long_wq;
 extern struct workqueue_struct *system_unbound_wq;
 extern struct workqueue_struct *system_highpri_wq;
 extern struct workqueue_struct *system_power_efficient_wq;
+extern struct workqueue_struct *system_percpu_wq;
 
 extern void linux_init_delayed_work(struct delayed_work *, work_func_t);
 extern void linux_work_fn(void *, int);
diff --git a/sys/compat/linuxkpi/common/src/linux_work.c b/sys/compat/linuxkpi/common/src/linux_work.c
index b1975d16025e..bb25893d9c71 100644
--- a/sys/compat/linuxkpi/common/src/linux_work.c
+++ b/sys/compat/linuxkpi/common/src/linux_work.c
@@ -57,6 +57,7 @@ struct workqueue_struct *system_long_wq;
 struct workqueue_struct *system_unbound_wq;
 struct workqueue_struct *system_highpri_wq;
 struct workqueue_struct *system_power_efficient_wq;
+struct workqueue_struct *system_percpu_wq;
 
 struct taskqueue *linux_irq_work_tq;
 
@@ -721,7 +722,14 @@ linux_work_init(void *arg)
 
 	/* populate the workqueue pointers */
 	system_long_wq = linux_system_long_wq;
+	/*
+	 * With Linux v6.17 system_wq was "renamed" to system_percpu_wq with the
+	 * old name staying around.
+	 * Note: neither implementation here does fully implement the per-cpu
+	 * characteristics upstream expects.
+	 */
 	system_wq = linux_system_short_wq;
+	system_percpu_wq = linux_system_short_wq;
 	system_power_efficient_wq = linux_system_short_wq;
 	system_unbound_wq = linux_system_short_wq;
 	system_highpri_wq = linux_system_short_wq;
@@ -737,6 +745,7 @@ linux_work_uninit(void *arg)
 	/* clear workqueue pointers */
 	system_long_wq = NULL;
 	system_wq = NULL;
+	system_percpu_wq = NULL;
 	system_power_efficient_wq = NULL;
 	system_unbound_wq = NULL;
 	system_highpri_wq = NULL;