mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-09-15 13:50:11 +03:00
spa: ZIO_TASKQ_ISSUE: Use symbolic priority
This allows to change the meaning of priority differences in FreeBSD without requiring code changes in ZFS. This upstreams commit fd141584cf89d7d2 from FreeBSD src. Sponsored-by: The FreeBSD Foundation Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Olivier Certner <olce@FreeBSD.org> Closes #17489
This commit is contained in:
parent
094305c937
commit
5289f6f961
@ -45,7 +45,9 @@
|
|||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#define CPU curcpu
|
#define CPU curcpu
|
||||||
#define minclsyspri PRIBIO
|
#define minclsyspri PRIBIO
|
||||||
#define defclsyspri minclsyspri
|
#define defclsyspri minclsyspri
|
||||||
|
/* Write issue taskq priority. */
|
||||||
|
#define wtqclsyspri ((PVM + PRIBIO) / 2)
|
||||||
#define maxclsyspri PVM
|
#define maxclsyspri PVM
|
||||||
#define max_ncpus (mp_maxid + 1)
|
#define max_ncpus (mp_maxid + 1)
|
||||||
#define boot_max_ncpus (mp_maxid + 1)
|
#define boot_max_ncpus (mp_maxid + 1)
|
||||||
|
@ -92,8 +92,10 @@
|
|||||||
* Treat shim tasks as SCHED_NORMAL tasks
|
* Treat shim tasks as SCHED_NORMAL tasks
|
||||||
*/
|
*/
|
||||||
#define minclsyspri (MAX_PRIO-1)
|
#define minclsyspri (MAX_PRIO-1)
|
||||||
#define maxclsyspri (MAX_RT_PRIO)
|
|
||||||
#define defclsyspri (DEFAULT_PRIO)
|
#define defclsyspri (DEFAULT_PRIO)
|
||||||
|
/* Write issue taskq priority. */
|
||||||
|
#define wtqclsyspri (MAX_RT_PRIO + 1)
|
||||||
|
#define maxclsyspri (MAX_RT_PRIO)
|
||||||
|
|
||||||
#ifndef NICE_TO_PRIO
|
#ifndef NICE_TO_PRIO
|
||||||
#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
|
#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
|
||||||
|
@ -628,8 +628,10 @@ extern void delay(clock_t ticks);
|
|||||||
* Process priorities as defined by setpriority(2) and getpriority(2).
|
* Process priorities as defined by setpriority(2) and getpriority(2).
|
||||||
*/
|
*/
|
||||||
#define minclsyspri 19
|
#define minclsyspri 19
|
||||||
#define maxclsyspri -20
|
|
||||||
#define defclsyspri 0
|
#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 ((uintptr_t)pthread_self() & (max_ncpus - 1))
|
||||||
#define CPU_SEQID_UNSTABLE CPU_SEQID
|
#define CPU_SEQID_UNSTABLE CPU_SEQID
|
||||||
|
@ -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);
|
spa->spa_proc, zio_taskq_basedc, flags);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
pri_t pri = maxclsyspri;
|
|
||||||
/*
|
/*
|
||||||
* The write issue taskq can be extremely CPU
|
* The write issue taskq can be extremely CPU
|
||||||
* intensive. Run it at slightly less important
|
* intensive. Run it at slightly less important
|
||||||
* priority than the other taskqs.
|
* 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) {
|
const pri_t pri = (t == ZIO_TYPE_WRITE &&
|
||||||
#if defined(__linux__)
|
q == ZIO_TASKQ_ISSUE) ?
|
||||||
pri++;
|
wtqclsyspri : maxclsyspri;
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
pri += 4;
|
|
||||||
#else
|
|
||||||
#error "unknown OS"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
tq = taskq_create_proc(name, value, pri, 50,
|
tq = taskq_create_proc(name, value, pri, 50,
|
||||||
INT_MAX, spa->spa_proc, flags);
|
INT_MAX, spa->spa_proc, flags);
|
||||||
#ifdef HAVE_SYSDC
|
#ifdef HAVE_SYSDC
|
||||||
|
Loading…
Reference in New Issue
Block a user