summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2012-01-28 14:00:21 +0000
committerattilio <attilio@FreeBSD.org>2012-01-28 14:00:21 +0000
commit1521eb447956638ea699e9468527cdcbd2b28659 (patch)
tree51e3a468764edd7cbdf62d40b3ad43948e5ccd09 /sys/sys
parenta1d2d789bd56b6e4fbadcea3ce4cab8cd7fed168 (diff)
downloadFreeBSD-src-1521eb447956638ea699e9468527cdcbd2b28659.zip
FreeBSD-src-1521eb447956638ea699e9468527cdcbd2b28659.tar.gz
Avoid to check the same cache line/variable from all the locking
primitives by breaking stop_scheduler into a per-thread variable. Also, store the new td_stopsched very close to td_*locks members as they will be accessed mostly in the same codepaths as td_stopsched and this results in avoiding a further cache-line pollution, possibly. STOP_SCHEDULER() was pondered to use a new 'thread' argument, in order to take advantage of already cached curthread, but in the end there should not really be a performance benefit, while introducing a KPI breakage. In collabouration with: flo Reviewed by: avg MFC after: 3 months (or never) X-MFC: r228424
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/proc.h1
-rw-r--r--sys/sys/systm.h3
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index ba00a88..76f3355 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -235,6 +235,7 @@ struct thread {
short td_locks; /* (k) Count of non-spin locks. */
short td_rw_rlocks; /* (k) Count of rwlock read locks. */
short td_lk_slocks; /* (k) Count of lockmgr shared locks. */
+ short td_stopsched; /* (k) Scheduler stopped. */
struct turnstile *td_blocked; /* (t) Lock thread is blocked on. */
const char *td_lockname; /* (t) Name of lock blocked on. */
LIST_HEAD(, turnstile) td_contested; /* (q) Contested locks. */
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index e5d60d4..47b974a 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -47,7 +47,6 @@
extern int cold; /* nonzero if we are doing a cold boot */
extern int rebooting; /* kern_reboot() has been called. */
-extern int stop_scheduler; /* only one thread runs after panic */
extern const char *panicstr; /* panic message */
extern char version[]; /* system version */
extern char copyright[]; /* system copyright */
@@ -113,7 +112,7 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN };
* Otherwise, the kernel will deadlock since the scheduler isn't
* going to run the thread that holds any lock we need.
*/
-#define SCHEDULER_STOPPED() __predict_false(stop_scheduler)
+#define SCHEDULER_STOPPED() __predict_false(curthread->td_stopsched)
/*
* XXX the hints declarations are even more misplaced than most declarations
OpenPOWER on IntegriCloud