Date: Sat, 30 Jun 2012 23:34:34 +0000 (UTC) From: Davide Italiano <davide@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r237859 - in projects/calloutng/sys: conf kern Message-ID: <201206302334.q5UNYYGN047979@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davide Date: Sat Jun 30 23:34:33 2012 New Revision: 237859 URL: http://svn.freebsd.org/changeset/base/237859 Log: Add a new CALLOUT_PROFILING option so that SYSCTLs on the wheel may be selectively disabled/enabled. Reintroduce a SYSCTL that I wrongly removed in a previous commit. Selectively disabling this sort of rudimentary profiling may have a good effect on CPU caches because same variable is not accessed anymore by different CPUs. Discussed with: mav Modified: projects/calloutng/sys/conf/NOTES projects/calloutng/sys/conf/options projects/calloutng/sys/kern/kern_timeout.c Modified: projects/calloutng/sys/conf/NOTES ============================================================================== --- projects/calloutng/sys/conf/NOTES Sat Jun 30 23:29:34 2012 (r237858) +++ projects/calloutng/sys/conf/NOTES Sat Jun 30 23:34:33 2012 (r237859) @@ -1,4 +1,4 @@ -# $FreeBSD$ + # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -259,6 +259,8 @@ options SX_NOINLINE # SMP Debugging Options: # +# CALLOUT_PROFILING enables rudimentary profiling of the callwheel data +# structure used as backend in callout(9). # PREEMPTION allows the threads that are in the kernel to be preempted by # higher priority [interrupt] threads. It helps with interactivity # and allows interrupt threads to run sooner rather than waiting. @@ -297,6 +299,9 @@ options LOCK_PROFILING options MPROF_BUFFERS="1536" options MPROF_HASH_SIZE="1543" +# Profiling for the callout(9) backend. +options CALLOUT_PROFILING + # Profiling for internal hash tables. options SLEEPQUEUE_PROFILING options TURNSTILE_PROFILING Modified: projects/calloutng/sys/conf/options ============================================================================== --- projects/calloutng/sys/conf/options Sat Jun 30 23:29:34 2012 (r237858) +++ projects/calloutng/sys/conf/options Sat Jun 30 23:34:33 2012 (r237859) @@ -66,6 +66,7 @@ SYSCTL_DEBUG opt_sysctl.h ADAPTIVE_LOCKMGRS ALQ AUDIT opt_global.h +CALLOUT_PROFILING CAPABILITIES opt_capsicum.h CAPABILITY_MODE opt_capsicum.h CODA_COMPAT_5 opt_coda.h Modified: projects/calloutng/sys/kern/kern_timeout.c ============================================================================== --- projects/calloutng/sys/kern/kern_timeout.c Sat Jun 30 23:29:34 2012 (r237858) +++ projects/calloutng/sys/kern/kern_timeout.c Sat Jun 30 23:34:33 2012 (r237859) @@ -37,6 +37,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_callout_profiling.h" #include "opt_kdtrace.h" #include <sys/param.h> @@ -69,6 +70,10 @@ SDT_PROBE_DEFINE(callout_execute, kernel SDT_PROBE_ARGTYPE(callout_execute, kernel, , callout_end, 0, "struct callout *"); +#ifdef CALLOUT_PROFILING +static int avg_depth; +SYSCTL_INT(_debug, OID_AUTO, to_avg_depth, CTLFLAG_RD, &avg_depth, 0, + "Average number of items examined per softclock call. Units = 1/1000"); static int avg_gcalls; SYSCTL_INT(_debug, OID_AUTO, to_avg_gcalls, CTLFLAG_RD, &avg_gcalls, 0, "Average number of Giant callouts made per softclock call. Units = 1/1000"); @@ -78,6 +83,7 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_lock static int avg_mpcalls; SYSCTL_INT(_debug, OID_AUTO, to_avg_mpcalls, CTLFLAG_RD, &avg_mpcalls, 0, "Average number of MP callouts made per softclock call. Units = 1/1000"); +#endif /* * TODO: * allocate more timeout table slots when table overflows. @@ -784,10 +790,12 @@ softclock(void *arg) steps = 0; } } - +#ifdef CALLOUT_PROFILING + avg_depth += (depth * 1000 - avg_depth) >> 8; avg_mpcalls += (mpcalls * 1000 - avg_mpcalls) >> 8; avg_lockcalls += (lockcalls * 1000 - avg_lockcalls) >> 8; avg_gcalls += (gcalls * 1000 - avg_gcalls) >> 8; +#endif cc->cc_next = NULL; CC_UNLOCK(cc); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206302334.q5UNYYGN047979>