git: fd141584cf89 - main - zfs: spa: ZIO_TASKQ_ISSUE: Use symbolic priority
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Jun 2025 02:13:25 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=fd141584cf89d7d24543ef5be83c6927a5d67ffa
commit fd141584cf89d7d24543ef5be83c6927a5d67ffa
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-05-21 14:23:32 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-06-18 02:08:02 +0000
zfs: spa: ZIO_TASKQ_ISSUE: Use symbolic priority
This allows to change the meaning of priority differences in FreeBSD
without requiring code changes in ZFS.
MFC after: 1 month
Event: Kitchener-Waterloo Hackathon 202506
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45390
---
.../openzfs/include/os/freebsd/spl/sys/proc.h | 4 +++-
.../openzfs/include/os/linux/spl/sys/sysmacros.h | 4 +++-
sys/contrib/openzfs/include/sys/zfs_context.h | 4 +++-
sys/contrib/openzfs/module/zfs/spa.c | 21 +++------------------
4 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h
index a03b815a22a6..c6bc10d6babe 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h
@@ -45,7 +45,9 @@
#ifdef _KERNEL
#define CPU curcpu
#define minclsyspri PRIBIO
-#define defclsyspri minclsyspri
+#define defclsyspri minclsyspri
+/* Write issue taskq priority. */
+#define wtqclsyspri ((PVM + PRIBIO) / 2)
#define maxclsyspri PVM
#define max_ncpus (mp_maxid + 1)
#define boot_max_ncpus (mp_maxid + 1)
diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h
index e932ea72f1be..db48222b712a 100644
--- a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h
+++ b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h
@@ -92,8 +92,10 @@
* Treat shim tasks as SCHED_NORMAL tasks
*/
#define minclsyspri (MAX_PRIO-1)
-#define maxclsyspri (MAX_RT_PRIO)
#define defclsyspri (DEFAULT_PRIO)
+/* Write issue taskq priority. */
+#define wtqclsyspri (MAX_RT_PRIO + 1)
+#define maxclsyspri (MAX_RT_PRIO)
#ifndef NICE_TO_PRIO
#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
diff --git a/sys/contrib/openzfs/include/sys/zfs_context.h b/sys/contrib/openzfs/include/sys/zfs_context.h
index b3d48e257538..256c9c2cc2d3 100644
--- a/sys/contrib/openzfs/include/sys/zfs_context.h
+++ b/sys/contrib/openzfs/include/sys/zfs_context.h
@@ -623,8 +623,10 @@ extern void delay(clock_t ticks);
* Process priorities as defined by setpriority(2) and getpriority(2).
*/
#define minclsyspri 19
-#define maxclsyspri -20
#define defclsyspri 0
+/* Write issue taskq priority. */
+#define wtqclsyspri -19
+#define maxclsyspri -20
#define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1))
#define CPU_SEQID_UNSTABLE CPU_SEQID
diff --git a/sys/contrib/openzfs/module/zfs/spa.c b/sys/contrib/openzfs/module/zfs/spa.c
index 29c1d4ddf47c..7bc659da6279 100644
--- a/sys/contrib/openzfs/module/zfs/spa.c
+++ b/sys/contrib/openzfs/module/zfs/spa.c
@@ -1231,29 +1231,14 @@ spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q)
spa->spa_proc, zio_taskq_basedc, flags);
} else {
#endif
- pri_t pri = maxclsyspri;
/*
* The write issue taskq can be extremely CPU
* intensive. Run it at slightly less important
* priority than the other taskqs.
- *
- * Under Linux and FreeBSD this means incrementing
- * the priority value as opposed to platforms like
- * illumos where it should be decremented.
- *
- * On FreeBSD, if priorities divided by four (RQ_PPQ)
- * are equal then a difference between them is
- * insignificant.
*/
- if (t == ZIO_TYPE_WRITE && q == ZIO_TASKQ_ISSUE) {
-#if defined(__linux__)
- pri++;
-#elif defined(__FreeBSD__)
- pri += 4;
-#else
-#error "unknown OS"
-#endif
- }
+ const pri_t pri = (t == ZIO_TYPE_WRITE &&
+ q == ZIO_TASKQ_ISSUE) ?
+ wtqclsyspri : maxclsyspri;
tq = taskq_create_proc(name, value, pri, 50,
INT_MAX, spa->spa_proc, flags);
#ifdef HAVE_SYSDC