diff options
| author | Bryan Cantrill <bryan@joyent.com> | 2020-09-21 22:00:14 -0700 |
|---|---|---|
| committer | Joshua M. Clulow <josh@sysmgr.org> | 2020-09-23 15:22:51 -0700 |
| commit | 6d40a71ead689b14c68d91a5d92845e5f3daa020 (patch) | |
| tree | ae3d12663f2ed954563a9a7f7a1d8f860c4c317a /usr/src | |
| parent | cfd17c15945080ff766acfba4bfbc0ac4d2d31cd (diff) | |
| download | illumos-joyent-6d40a71ead689b14c68d91a5d92845e5f3daa020.tar.gz | |
1532 Long-term kernel-resident processes need a way to play fair
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/uts/common/disp/disp.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/usr/src/uts/common/disp/disp.c b/usr/src/uts/common/disp/disp.c index a4b49fa86d..2b9662d931 100644 --- a/usr/src/uts/common/disp/disp.c +++ b/usr/src/uts/common/disp/disp.c @@ -110,7 +110,7 @@ static void cpu_resched(cpu_t *cp, pri_t tpri); /* * If this is set, only interrupt threads will cause kernel preemptions. * This is done by changing the value of kpreemptpri. kpreemptpri - * will either be the max sysclass pri + 1 or the min interrupt pri. + * will either be the max sysclass pri or the min interrupt pri. */ int only_intr_kpreempt; @@ -257,7 +257,23 @@ dispinit(void) maxglobpri = cl_maxglobpri; } } - kpreemptpri = (pri_t)v.v_maxsyspri + 1; + + /* + * Historically, kpreemptpri was set to v_maxsyspri + 1 -- which is + * to say, maxclsyspri + 1. However, over time, the system has used + * more and more asynchronous kernel threads, with an increasing number + * of these doing work on direct behalf of higher-level software (e.g., + * network processing). This has led to potential priority inversions: + * threads doing low-priority lengthy kernel work can effectively + * delay kernel-level processing of higher-priority data. To minimize + * such inversions, we set kpreemptpri to be v_maxsyspri; anything in + * the kernel that runs at maxclsyspri will therefore induce kernel + * preemption, and this priority should be used if/when an asynchronous + * thread (or, as is often the case, task queue) is performing a task + * on behalf of higher-level software (or any task that is otherwise + * latency-sensitve). + */ + kpreemptpri = (pri_t)v.v_maxsyspri; if (kpqpri == KPQPRI) kpqpri = kpreemptpri; |
