Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys schedstate_percpu: add new flag SPCF_IDLE as a cheap and...
details: https://anonhg.NetBSD.org/src/rev/cc14402cbe95
branches: trunk
changeset: 1005795:cc14402cbe95
user: ad <ad%NetBSD.org@localhost>
date: Sat Dec 21 11:54:04 2019 +0000
description:
schedstate_percpu: add new flag SPCF_IDLE as a cheap and easy way to
determine that a CPU is currently idle.
diffstat:
sys/kern/kern_synch.c | 8 +++++---
sys/sys/sched.h | 3 ++-
2 files changed, 7 insertions(+), 4 deletions(-)
diffs (57 lines):
diff -r e3cf82bd8003 -r cc14402cbe95 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c Sat Dec 21 11:41:18 2019 +0000
+++ b/sys/kern/kern_synch.c Sat Dec 21 11:54:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_synch.c,v 1.333 2019/12/20 21:52:51 ad Exp $ */
+/* $NetBSD: kern_synch.c,v 1.334 2019/12/21 11:54:04 ad Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.333 2019/12/20 21:52:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.334 2019/12/21 11:54:04 ad Exp $");
#include "opt_kstack.h"
#include "opt_dtrace.h"
@@ -487,10 +487,13 @@
newl->l_stat = LSONPROC;
newl->l_pflag |= LP_RUNNING;
lwp_setlock(newl, spc->spc_lwplock);
+ spc->spc_flags &= ~(SPCF_SWITCHCLEAR | SPCF_IDLE);
} else {
newl = ci->ci_data.cpu_idlelwp;
newl->l_stat = LSONPROC;
newl->l_pflag |= LP_RUNNING;
+ spc->spc_flags = (spc->spc_flags & ~SPCF_SWITCHCLEAR) |
+ SPCF_IDLE;
}
/*
@@ -501,7 +504,6 @@
* the release of spc_mutex becomes globally visible.
*/
ci->ci_want_resched = ci->ci_data.cpu_softints;
- spc->spc_flags &= ~SPCF_SWITCHCLEAR;
spc->spc_curpriority = lwp_eprio(newl);
return newl;
diff -r e3cf82bd8003 -r cc14402cbe95 sys/sys/sched.h
--- a/sys/sys/sched.h Sat Dec 21 11:41:18 2019 +0000
+++ b/sys/sys/sched.h Sat Dec 21 11:54:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sched.h,v 1.81 2019/12/20 21:05:34 ad Exp $ */
+/* $NetBSD: sched.h,v 1.82 2019/12/21 11:54:04 ad Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2007, 2008, 2019
@@ -187,6 +187,7 @@
#define SPCF_RUNNING 0x0008 /* CPU is running */
#define SPCF_NOINTR 0x0010 /* shielded from interrupts */
#define SPCF_SMTPRIMARY 0x0020 /* CPU is first thread in core */
+#define SPCF_IDLE 0x0040 /* CPU is currently idle */
#define SPCF_SWITCHCLEAR (SPCF_SEENRR|SPCF_SHOULDYIELD)
Home |
Main Index |
Thread Index |
Old Index