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
This commit is contained in:
parent
f5764938de
commit
5d7380f8e3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230643
@ -42,6 +42,7 @@
|
||||
#include <sys/callout.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/priv.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
|
@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/errno.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/gpt.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/uuid.h>
|
||||
#include <geom/geom.h>
|
||||
|
@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/md5.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <sys/diskmbr.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bio.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sbuf.h>
|
||||
|
||||
#include <sys/diskpc98.h>
|
||||
|
@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@ -145,7 +145,6 @@ SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW,
|
||||
*/
|
||||
const char *panicstr;
|
||||
|
||||
int stop_scheduler; /* system stopped CPUs for panic */
|
||||
int dumping; /* system is dumping */
|
||||
int rebooting; /* system is rebooting */
|
||||
static struct dumperinfo dumper; /* our selected dumper */
|
||||
@ -597,7 +596,7 @@ panic(const char *fmt, ...)
|
||||
* stop_scheduler_on_panic is true, then stop_scheduler will
|
||||
* always be set. Even if panic has been entered from kdb.
|
||||
*/
|
||||
stop_scheduler = 1;
|
||||
td->td_stopsched = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user