Date: Sat, 28 Jan 2012 14:00:21 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r230643 - in head/sys: dev/usb geom geom/mountver kern sys Message-ID: <201201281400.q0SE0LdE088986@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Sat Jan 28 14:00:21 2012 New Revision: 230643 URL: http://svn.freebsd.org/changeset/base/230643 Log: 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 Modified: head/sys/dev/usb/usb_transfer.c head/sys/geom/geom_bsd.c head/sys/geom/geom_mbr.c head/sys/geom/geom_pc98.c head/sys/geom/mountver/g_mountver.c head/sys/kern/kern_shutdown.c head/sys/sys/proc.h head/sys/sys/systm.h Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/dev/usb/usb_transfer.c Sat Jan 28 14:00:21 2012 (r230643) @@ -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> Modified: head/sys/geom/geom_bsd.c ============================================================================== --- head/sys/geom/geom_bsd.c Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/geom/geom_bsd.c Sat Jan 28 14:00:21 2012 (r230643) @@ -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> Modified: head/sys/geom/geom_mbr.c ============================================================================== --- head/sys/geom/geom_mbr.c Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/geom/geom_mbr.c Sat Jan 28 14:00:21 2012 (r230643) @@ -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> Modified: head/sys/geom/geom_pc98.c ============================================================================== --- head/sys/geom/geom_pc98.c Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/geom/geom_pc98.c Sat Jan 28 14:00:21 2012 (r230643) @@ -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> Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/geom/mountver/g_mountver.c Sat Jan 28 14:00:21 2012 (r230643) @@ -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> Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/kern/kern_shutdown.c Sat Jan 28 14:00:21 2012 (r230643) @@ -145,7 +145,6 @@ SYSCTL_INT(_kern_shutdown, OID_AUTO, sho */ 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 Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/sys/proc.h Sat Jan 28 14:00:21 2012 (r230643) @@ -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. */ Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sat Jan 28 13:41:34 2012 (r230642) +++ head/sys/sys/systm.h Sat Jan 28 14:00:21 2012 (r230643) @@ -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_GUES * 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201281400.q0SE0LdE088986>