summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-07-15 20:44:48 +0000
committermpi <mpi@openbsd.org>2019-07-15 20:44:48 +0000
commit764fc8a08437c4c7edc08f1ff70fc52a78b3ac27 (patch)
tree6002134d44be0420a961fbd2843548df88e63d90 /sys/kern
parentexplain escaping of end-of-sentence characters; (diff)
downloadwireguard-openbsd-764fc8a08437c4c7edc08f1ff70fc52a78b3ac27.tar.xz
wireguard-openbsd-764fc8a08437c4c7edc08f1ff70fc52a78b3ac27.zip
Stop calling resched_proc() after changing the nice(3) value of a process.
Changing the scheduling priority of a process happens rarely, so it isn't strictly necessary to update the current priority of every threads instantly. Moreover resched_proc() isn't well suited to perform this action: it doesn't consider the state of each thread nor move them to another runqueue. ok visa@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_resource.c3
-rw-r--r--sys/kern/sched_bsd.c9
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 760f7a73bb8..341315d03e0 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_resource.c,v 1.67 2019/07/08 18:53:18 mpi Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.68 2019/07/15 20:44:48 mpi Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
@@ -214,7 +214,6 @@ donice(struct proc *curp, struct process *chgpr, int n)
SCHED_LOCK(s);
TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) {
setpriority(p, p->p_estcpu, n);
- resched_proc(p, p->p_usrpri);
}
SCHED_UNLOCK(s);
return (0);
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index d413f726320..f4658d776ea 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.54 2019/07/08 18:53:18 mpi Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.55 2019/07/15 20:44:48 mpi Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -61,8 +61,9 @@ int rrticks_init; /* # of hardclock ticks per roundrobin() */
struct __mp_lock sched_lock;
#endif
-void schedcpu(void *);
-uint32_t decay_aftersleep(uint32_t, uint32_t);
+void schedcpu(void *);
+uint32_t decay_aftersleep(uint32_t, uint32_t);
+static inline void resched_proc(struct proc *, u_char);
void
scheduler_start(void)
@@ -442,7 +443,7 @@ mi_switch(void)
#endif
}
-void
+static inline void
resched_proc(struct proc *p, u_char pri)
{
struct cpu_info *ci;