From owner-svn-src-head@FreeBSD.ORG Sat Jan 28 14:00:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86992106564A; Sat, 28 Jan 2012 14:00:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FE858FC0A; Sat, 28 Jan 2012 14:00:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SE0LY9088995; Sat, 28 Jan 2012 14:00:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SE0LdE088986; Sat, 28 Jan 2012 14:00:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201201281400.q0SE0LdE088986@svn.freebsd.org> From: Attilio Rao Date: Sat, 28 Jan 2012 14:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230643 - in head/sys: dev/usb geom geom/mountver kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 14:00:21 -0000 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 #include #include +#include #include #include 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 #include #include +#include #include #include #include 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 #include #include +#include #include #include 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 #include #include +#include #include #include 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 #include #include +#include #include #include #include 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