From 3a63f5a8da8dffdd6c93401ac0dcdc6ea494104e Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 30 Aug 2023 09:02:38 +0000 Subject: [PATCH] Preempt a running proc even if there is no other process/thread queued on that CPU's runqueue. This way mi_switch() is invoked which is necessary to a) signal srm that the cpu changed context b) runtime stats are updated c) requests to stop the CPU are checked. This should fix the issue reported by Eric Wong (e at 80x24 org) that RLIMIT_CPU is unreliable on idle systems. OK kettenis@ cheloha@ --- sys/kern/sched_bsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index 465624e589d..2f9ef56aee1 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.84 2023/08/29 16:19:34 claudio Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.85 2023/08/30 09:02:38 claudio Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -106,7 +106,7 @@ roundrobin(struct clockintr *cl, void *cf) } } - if (spc->spc_nrun) + if (spc->spc_nrun || spc->spc_schedflags & SPCF_SHOULDYIELD) need_resched(ci); } -- 2.20.1