From 49e744c65c8e3d2f72357f865dbd1908796950cf Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 12 Aug 2025 22:06:41 -0400 Subject: kernel: proc: Improve handling of 'nswitch' - Extend 'nswitch' to 64-bits as it increments fast - Ensure writes to 'nswitch' are atomic Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/proc_machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/arch') diff --git a/sys/arch/amd64/amd64/proc_machdep.c b/sys/arch/amd64/amd64/proc_machdep.c index ad807fe..a1d6563 100644 --- a/sys/arch/amd64/amd64/proc_machdep.c +++ b/sys/arch/amd64/amd64/proc_machdep.c @@ -256,7 +256,7 @@ sched_switch_to(struct trapframe *tf, struct proc *td) /* Update stats */ cpustat = &ci->stat; - cpustat->nswitch++; + atomic_inc_64(&cpustat->nswitch); ci->curtd = td; pcbp = &td->pcb; -- cgit v1.2.3