diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -14295,7 +14295,7 @@ CTL_DEBUG_PRINT(("ctl_work_thread starting\n")); thread_lock(curthread); - sched_prio(curthread, PUSER - 1); + sched_prio(curthread, PRI_MAX_KERN); thread_unlock(curthread); while (!softc->shutdown) { @@ -14387,7 +14387,7 @@ CTL_DEBUG_PRINT(("ctl_thresh_thread starting\n")); thread_lock(curthread); - sched_prio(curthread, PUSER - 1); + sched_prio(curthread, PRI_MAX_KERN); thread_unlock(curthread); while (!softc->shutdown) { diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h @@ -44,7 +44,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 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h @@ -91,8 +91,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 --- a/sys/contrib/openzfs/include/sys/zfs_context.h +++ b/sys/contrib/openzfs/include/sys/zfs_context.h @@ -622,8 +622,10 @@ * 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 --- a/sys/contrib/openzfs/module/zfs/spa.c +++ b/sys/contrib/openzfs/module/zfs/spa.c @@ -1222,29 +1222,14 @@ 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 diff --git a/sys/dev/beri/beri_ring.c b/sys/dev/beri/beri_ring.c --- a/sys/dev/beri/beri_ring.c +++ b/sys/dev/beri/beri_ring.c @@ -170,7 +170,7 @@ } mtx_lock(&sc->beri_mtx); - selwakeuppri(&sc->beri_rsel, PZERO + 1); + selwakeuppri(&sc->beri_rsel, PZERO); KNOTE_LOCKED(&sc->beri_rsel.si_note, 0); mtx_unlock(&sc->beri_mtx); } @@ -190,7 +190,7 @@ } mtx_lock(&sc->beri_mtx); - selwakeuppri(&sc->beri_rsel, PZERO + 1); + selwakeuppri(&sc->beri_rsel, PZERO); KNOTE_LOCKED(&sc->beri_rsel.si_note, 0); mtx_unlock(&sc->beri_mtx); } diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -293,7 +293,7 @@ extern devclass_t firewire_devclass; extern int firewire_phydma_enable; -#define FWPRI ((PZERO + 8) | PCATCH) +#define FWPRI (PWAIT | PCATCH) #define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -1310,7 +1310,7 @@ if (i == sc->cur_scp->index) return 0; error = - tsleep(VTY_WCHAN(sc, i), (PZERO + 1) | PCATCH, "waitvt", 0); + tsleep(VTY_WCHAN(sc, i), PZERO | PCATCH, "waitvt", 0); return error; case VT_GETACTIVE: /* get active vty # */ diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c --- a/sys/dev/vkbd/vkbd.c +++ b/sys/dev/vkbd/vkbd.c @@ -82,7 +82,7 @@ #define VKBD_UNLOCK(s) mtx_unlock(&(s)->ks_lock) #define VKBD_LOCK_ASSERT(s, w) mtx_assert(&(s)->ks_lock, w) #define VKBD_SLEEP(s, f, d, t) \ - msleep(&(s)->f, &(s)->ks_lock, PCATCH | (PZERO + 1), d, t) + msleep(&(s)->f, &(s)->ks_lock, PCATCH | PZERO, d, t) #else #define VKBD_LOCK_DECL #define VKBD_LOCK_INIT(s) @@ -90,7 +90,7 @@ #define VKBD_LOCK(s) #define VKBD_UNLOCK(s) #define VKBD_LOCK_ASSERT(s, w) -#define VKBD_SLEEP(s, f, d, t) tsleep(&(s)->f, PCATCH | (PZERO + 1), d, t) +#define VKBD_SLEEP(s, f, d, t) tsleep(&(s)->f, PCATCH | PZERO, d, t) #endif #define VKBD_KEYBOARD(d) \ @@ -268,8 +268,8 @@ VKBD_SLEEP(state, ks_task, "vkbdc", 0); /* wakeup poll()ers */ - selwakeuppri(&state->ks_rsel, PZERO + 1); - selwakeuppri(&state->ks_wsel, PZERO + 1); + selwakeuppri(&state->ks_rsel, PZERO); + selwakeuppri(&state->ks_wsel, PZERO); state->ks_flags &= ~OPEN; state->ks_dev = NULL; @@ -498,7 +498,7 @@ if (!(state->ks_flags & STATUS)) { state->ks_flags |= STATUS; - selwakeuppri(&state->ks_rsel, PZERO + 1); + selwakeuppri(&state->ks_rsel, PZERO); wakeup(&state->ks_flags); } } @@ -531,7 +531,7 @@ q->head = 0; /* wakeup ks_inq writers/poll()ers */ - selwakeuppri(&state->ks_wsel, PZERO + 1); + selwakeuppri(&state->ks_wsel, PZERO); wakeup(q); return (c); @@ -1246,7 +1246,7 @@ /* flush ks_inq and wakeup writers/poll()ers */ state->ks_inq.head = state->ks_inq.tail = state->ks_inq.cc = 0; - selwakeuppri(&state->ks_wsel, PZERO + 1); + selwakeuppri(&state->ks_wsel, PZERO); wakeup(&state->ks_inq); } diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -152,7 +152,7 @@ FUSE_LOCK(); fuse_lck_mtx_lock(fdata->aw_mtx); /* wakup poll()ers */ - selwakeuppri(&fdata->ks_rsel, PZERO + 1); + selwakeuppri(&fdata->ks_rsel, PZERO); /* Don't let syscall handlers wait in vain */ while ((tick = fuse_aw_pop(fdata))) { fuse_lck_mtx_lock(tick->tk_aw_mtx); diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -932,7 +932,7 @@ if (vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF) return EIO; fvdat->flag |= FN_FLUSHWANT; - tsleep(&fvdat->flag, PRIBIO + 2, "fusevinv", 2 * hz); + tsleep(&fvdat->flag, PRIBIO, "fusevinv", 2 * hz); error = 0; if (p != NULL) { PROC_LOCK(p); diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -593,7 +593,7 @@ fuse_lck_mtx_lock(data->ms_mtx); data->dataflags |= FSESS_DEAD; wakeup_one(data); - selwakeuppri(&data->ks_rsel, PZERO + 1); + selwakeuppri(&data->ks_rsel, PZERO); wakeup(&data->ticketer); fuse_lck_mtx_unlock(data->ms_mtx); FUSE_UNLOCK(); @@ -669,7 +669,7 @@ else fuse_ms_push(ftick); wakeup_one(ftick->tk_data); - selwakeuppri(&ftick->tk_data->ks_rsel, PZERO + 1); + selwakeuppri(&ftick->tk_data->ks_rsel, PZERO); KNOTE_LOCKED(&ftick->tk_data->ks_rsel.si_note, 0); fuse_lck_mtx_unlock(ftick->tk_data->ms_mtx); } diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4662,7 +4662,7 @@ ts.tv_sec = 0; ts.tv_nsec = 0; (void) nfsmsleep((caddr_t)flagp, NFSSOCKMUTEXPTR, - PZERO - 1, "nfsndlck", &ts); + PVFS, "nfsndlck", &ts); } *flagp |= NFSR_SNDLOCK; NFSUNLOCKSOCK(); diff --git a/sys/fs/nfsserver/nfs_nfsdcache.c b/sys/fs/nfsserver/nfs_nfsdcache.c --- a/sys/fs/nfsserver/nfs_nfsdcache.c +++ b/sys/fs/nfsserver/nfs_nfsdcache.c @@ -392,7 +392,7 @@ nfsaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) { if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP, + (void)mtx_sleep(rp, mutex, PVFS | PDROP, "nfsrc", 10 * hz); goto loop; } @@ -678,7 +678,7 @@ rp = hitrp; if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP, + (void)mtx_sleep(rp, mutex, PVFS | PDROP, "nfsrc", 10 * hz); goto tryagain; } @@ -750,7 +750,7 @@ mtx_assert(mutex, MA_OWNED); while ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, mutex, PZERO - 1, "nfsrc", 0); + (void)mtx_sleep(rp, mutex, PVFS, "nfsrc", 0); } rp->rc_flag |= RC_LOCKED; } diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -552,7 +552,7 @@ */ while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PVFS, "nfsd clp", 10 * hz); } NFSUNLOCKSTATE(); @@ -629,7 +629,7 @@ NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PVFS, "nfsdclp", 10 * hz); } NFSUNLOCKSTATE(); diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -629,7 +629,7 @@ while (np->n_flag & NFLUSHINPROG) { np->n_flag |= NFLUSHWANT; - error = tsleep(&np->n_flag, PRIBIO + 2, "smfsvinv", 2 * hz); + error = tsleep(&np->n_flag, PRIBIO, "smfsvinv", 2 * hz); error = smb_td_intr(td); if (error == EINTR) return EINTR; diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -1010,7 +1010,8 @@ mtx_lock(&rms->mtx); while (rms->writers > 0) - msleep(&rms->readers, &rms->mtx, PUSER - 1, mtx_name(&rms->mtx), 0); + msleep(&rms->readers, &rms->mtx, PRI_MAX_KERN, + mtx_name(&rms->mtx), 0); critical_enter(); rms_int_readers_inc(rms, rms_int_pcpu(rms)); mtx_unlock(&rms->mtx); @@ -1197,7 +1198,7 @@ mtx_lock(&rms->mtx); rms->writers++; if (rms->writers > 1) { - msleep(&rms->owner, &rms->mtx, (PUSER - 1), + msleep(&rms->owner, &rms->mtx, PRI_MAX_KERN, mtx_name(&rms->mtx), 0); MPASS(rms->readers == 0); KASSERT(rms->owner == RMS_TRANSIENT, @@ -1213,7 +1214,7 @@ rms_assert_no_pcpu_readers(rms); if (rms->readers > 0) { - msleep(&rms->writers, &rms->mtx, (PUSER - 1), + msleep(&rms->writers, &rms->mtx, PRI_MAX_KERN, mtx_name(&rms->mtx), 0); } diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -47,7 +47,7 @@ #include #include -#define LOG_RDPRI (PZERO + 1) +#define LOG_RDPRI PZERO #define LOG_ASYNC 0x04 diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -894,7 +894,7 @@ we_own_it = 1; } DPRINTF(("msgsnd: goodnight\n")); - error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH, + error = msleep(msqkptr, &msq_mtx, PVFS | PCATCH, "msgsnd", hz); DPRINTF(("msgsnd: good morning, error=%d\n", error)); if (we_own_it) @@ -1303,7 +1303,7 @@ */ DPRINTF(("msgrcv: goodnight\n")); - error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH, + error = msleep(msqkptr, &msq_mtx, PVFS | PCATCH, "msgrcv", 0); DPRINTF(("msgrcv: good morning (error=%d)\n", error)); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1309,7 +1309,7 @@ semptr->semncnt++; DPRINTF(("semop: good night!\n")); - error = msleep_sbt(semakptr, sema_mtxp, (PZERO - 4) | PCATCH, + error = msleep_sbt(semakptr, sema_mtxp, PVFS | PCATCH, "semwait", sbt, precision, C_ABSOLUTE); DPRINTF(("semop: good morning (error=%d)!\n", error)); /* return code is checked below, after sem[nz]cnt-- */ diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -756,7 +756,7 @@ break; } error = msleep(&bd->bd_wanted, BD_LOCKPTR(bd), - (PRIBIO + 4) | slpflag, "newbuf", slptimeo); + PVFS | slpflag, "newbuf", slptimeo); if (error != 0) break; } @@ -2654,8 +2654,7 @@ mtx_lock(&bdirtylock); while (buf_dirty_count_severe()) { bdirtywait = 1; - msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4), - "flswai", 0); + msleep(&bdirtywait, &bdirtylock, PVFS, "flswai", 0); } mtx_unlock(&bdirtylock); } @@ -5234,7 +5233,7 @@ while (bo->bo_numoutput) { bo->bo_flag |= BO_WWAIT; error = msleep(&bo->bo_numoutput, BO_LOCKPTR(bo), - slpflag | (PRIBIO + 1), "bo_wwait", timeo); + slpflag | PRIBIO, "bo_wwait", timeo); if (error) break; } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -787,7 +787,7 @@ } DROP_GIANT(); sleepq_add(&fp->f_vnread_flags, NULL, "vofflock", 0, 0); - sleepq_wait(&fp->f_vnread_flags, PUSER -1); + sleepq_wait(&fp->f_vnread_flags, PRI_MAX_KERN); PICKUP_GIANT(); sleepq_lock(&fp->f_vnread_flags); state = atomic_load_16(flagsp); @@ -849,7 +849,7 @@ if ((flags & FOF_NOLOCK) == 0) { while (fp->f_vnread_flags & FOFFSET_LOCKED) { fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + msleep(&fp->f_vnread_flags, mtxp, PRI_MAX_KERN, "vofflock", 0); } fp->f_vnread_flags |= FOFFSET_LOCKED; @@ -1897,7 +1897,7 @@ if (flags & V_PCATCH) mflags |= PCATCH; } - mflags |= (PUSER - 1); + mflags |= PRI_MAX_KERN; while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { if ((flags & V_NOWAIT) != 0) { error = EWOULDBLOCK; @@ -2022,7 +2022,7 @@ if ((flags & V_PCATCH) != 0) mflags |= PCATCH; } - mflags |= (PUSER - 1) | PDROP; + mflags |= PRI_MAX_KERN | PDROP; error = msleep(&mp->mnt_flag, MNT_MTX(mp), mflags, "suspfs", 0); vfs_rel(mp); if (error == 0) @@ -2107,7 +2107,7 @@ return (EALREADY); } while (mp->mnt_kern_flag & MNTK_SUSPEND) - msleep(&mp->mnt_flag, MNT_MTX(mp), PUSER - 1, "wsuspfs", 0); + msleep(&mp->mnt_flag, MNT_MTX(mp), PRI_MAX_KERN, "wsuspfs", 0); /* * Unmount holds a write reference on the mount point. If we @@ -2128,7 +2128,7 @@ mp->mnt_susp_owner = curthread; if (mp->mnt_writeopcount > 0) (void) msleep(&mp->mnt_writeopcount, - MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0); + MNT_MTX(mp), PRI_MAX_KERN | PDROP, "suspwt", 0); else MNT_IUNLOCK(mp); if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) { diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -834,7 +834,7 @@ tp->tun_flags &= ~TUN_RWAIT; wakeup(tp); } - selwakeuppri(&tp->tun_rsel, PZERO + 1); + selwakeuppri(&tp->tun_rsel, PZERO); KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) { TUN_UNLOCK(tp); @@ -1169,7 +1169,7 @@ CURVNET_RESTORE(); funsetown(&tp->tun_sigio); - selwakeuppri(&tp->tun_rsel, PZERO + 1); + selwakeuppri(&tp->tun_rsel, PZERO); KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); TUNDEBUG (ifp, "closed\n"); tp->tun_flags &= ~TUN_OPEN; @@ -1703,7 +1703,7 @@ return (EWOULDBLOCK); } tp->tun_flags |= TUN_RWAIT; - error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1), + error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | PZERO, "tunread", 0); if (error != 0) { TUN_UNLOCK(tp); diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -462,7 +462,7 @@ mtx_lock(&priv->ngd_mtx); priv->flags |= NGDF_RWAIT; if ((error = msleep(priv, &priv->ngd_mtx, - PDROP | PCATCH | (PZERO + 1), + PDROP | PCATCH | PZERO, "ngdread", 0)) != 0) return (error); } diff --git a/sys/sys/buf.h b/sys/sys/buf.h --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -296,7 +296,7 @@ * Initialize a lock. */ #define BUF_LOCKINIT(bp, wmesg) \ - lockinit(&(bp)->b_lock, PRIBIO + 4, wmesg, 0, LK_NEW) + lockinit(&(bp)->b_lock, PVFS, wmesg, 0, LK_NEW) /* * * Get a lock sleeping non-interruptably until it becomes available. @@ -311,7 +311,7 @@ */ #define BUF_TIMELOCK(bp, locktype, interlock, wmesg, catch, timo) \ _lockmgr_args_rw(&(bp)->b_lock, (locktype) | LK_TIMELOCK, \ - (interlock), (wmesg), (PRIBIO + 4) | (catch), (timo), \ + (interlock), (wmesg), PVFS | (catch), (timo), \ LOCK_FILE, LOCK_LINE) /* diff --git a/sys/sys/param.h b/sys/sys/param.h --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -73,7 +73,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500023 +#define __FreeBSD_version 1500024 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/runq.h b/sys/sys/runq.h --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -29,12 +29,20 @@ #ifndef _RUNQ_H_ #define _RUNQ_H_ +#ifndef _KERNEL +#error "no user-serviceable parts inside" +#endif + +#include /* For bool. */ + +struct thread; + /* * Run queue parameters. */ #define RQ_MAX_PRIO (255) /* Maximum priority (minimum is 0). */ -#define RQ_PPQ (4) /* Priorities per queue. */ +#define RQ_PPQ (1) /* Priorities per queue. */ /* * Convenience macros from . @@ -71,11 +79,6 @@ RQSW_TO_QUEUE_IDX(word_idx, RQSW_BSF(word)) -#ifdef _KERNEL -#include /* For bool. */ - -struct thread; - /* * The queue for a given index as a list of threads. */ @@ -118,6 +121,5 @@ bool runq_not_empty(struct runq *); struct thread *runq_choose(struct runq *); struct thread *runq_choose_fuzz(struct runq *, int _fuzz); -#endif /* _KERNEL */ #endif diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -497,7 +497,7 @@ while (mp->mnt_secondary_writes != 0) { BO_UNLOCK(bo); msleep(&mp->mnt_secondary_writes, MNT_MTX(mp), - (PUSER - 1) | PDROP, "secwr", 0); + PRI_MAX_KERN | PDROP, "secwr", 0); BO_LOCK(bo); MNT_ILOCK(mp); } @@ -14557,7 +14557,7 @@ while (mp->mnt_secondary_writes != 0) { BO_UNLOCK(bo); msleep(&mp->mnt_secondary_writes, MNT_MTX(mp), - (PUSER - 1) | PDROP, "secwr", 0); + PRI_MAX_KERN | PDROP, "secwr", 0); BO_LOCK(bo); MNT_ILOCK(mp); } @@ -14597,7 +14597,7 @@ BO_UNLOCK(bo); msleep(&mp->mnt_secondary_writes, MNT_MTX(mp), - (PUSER - 1) | PDROP, "secwr", 0); + PRI_MAX_KERN | PDROP, "secwr", 0); BO_LOCK(bo); continue; } diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1399,8 +1399,7 @@ VI_LOCK(vp); while (ip->i_flag & IN_EA_LOCKED) { UFS_INODE_SET_FLAG(ip, IN_EA_LOCKWAIT); - msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD + 2, "ufs_ea", - 0); + msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD, "ufs_ea", 0); } UFS_INODE_SET_FLAG(ip, IN_EA_LOCKED); VI_UNLOCK(vp); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -179,7 +179,7 @@ if ((dq = ip->i_dquot[i]) == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkdq1"); + DQI_WAIT(dq, PINOD, "chkdq1"); ncurblocks = dq->dq_curblocks + change; if (ncurblocks >= 0) dq->dq_curblocks = ncurblocks; @@ -201,7 +201,7 @@ continue; warn = 0; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkdq2"); + DQI_WAIT(dq, PINOD, "chkdq2"); if (do_check) { error = chkdqchg(ip, change, cred, i, &warn); if (error) { @@ -215,7 +215,7 @@ if (dq == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkdq3"); + DQI_WAIT(dq, PINOD, "chkdq3"); ncurblocks = dq->dq_curblocks - change; if (ncurblocks >= 0) dq->dq_curblocks = ncurblocks; @@ -320,7 +320,7 @@ if ((dq = ip->i_dquot[i]) == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkiq1"); + DQI_WAIT(dq, PINOD, "chkiq1"); if (dq->dq_curinodes >= -change) dq->dq_curinodes += change; else @@ -341,7 +341,7 @@ continue; warn = 0; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkiq2"); + DQI_WAIT(dq, PINOD, "chkiq2"); if (do_check) { error = chkiqchg(ip, change, cred, i, &warn); if (error) { @@ -355,7 +355,7 @@ if (dq == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkiq3"); + DQI_WAIT(dq, PINOD, "chkiq3"); if (dq->dq_curinodes >= change) dq->dq_curinodes -= change; else @@ -855,7 +855,7 @@ return (error); dq = ndq; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "setqta"); + DQI_WAIT(dq, PINOD, "setqta"); /* * Copy all but the current values. * Reset time limit if previously had no soft limit or were @@ -918,7 +918,7 @@ return (error); dq = ndq; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "setuse"); + DQI_WAIT(dq, PINOD, "setuse"); /* * Reset time limit if have a soft limit and were * previously under it, but are now over it. @@ -1314,7 +1314,7 @@ if (dq != NULL) { DQH_UNLOCK(); hfound: DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "dqget"); + DQI_WAIT(dq, PINOD, "dqget"); DQI_UNLOCK(dq); if (dq->dq_ump == NULL) { dqrele(vp, dq); @@ -1588,7 +1588,7 @@ vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY); DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+2, "dqsync"); + DQI_WAIT(dq, PINOD, "dqsync"); if ((dq->dq_flags & DQ_MOD) == 0) goto out; dq->dq_flags |= DQ_LOCK; @@ -1742,7 +1742,7 @@ if ((dq = qrp[i]) == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "adjqta"); + DQI_WAIT(dq, PINOD, "adjqta"); ncurblocks = dq->dq_curblocks + blkcount; if (ncurblocks >= 0) dq->dq_curblocks = ncurblocks; diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -2027,7 +2026,7 @@ sched_get_priority_min(SCHED_FIFO)) / 2; CHILD_REQUIRE(pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched_param) == 0); - sched_param.sched_priority -= RQ_PPQ; + sched_param.sched_priority -= 1; CHILD_REQUIRE(pthread_setschedparam(t, SCHED_FIFO, &sched_param) == 0); @@ -2130,7 +2129,7 @@ sched_get_priority_min(SCHED_FIFO)) / 2; CHILD_REQUIRE(pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched_param) == 0); - sched_param.sched_priority -= RQ_PPQ; + sched_param.sched_priority -= 1; CHILD_REQUIRE(pthread_setschedparam(t, SCHED_FIFO, &sched_param) == 0);