From owner-svn-src-projects@FreeBSD.ORG Sat Jun 30 23:34:34 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 720821065670; Sat, 30 Jun 2012 23:34:34 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CD988FC08; Sat, 30 Jun 2012 23:34:34 +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 q5UNYYYf047984; Sat, 30 Jun 2012 23:34:34 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5UNYYGN047979; Sat, 30 Jun 2012 23:34:34 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206302334.q5UNYYGN047979@svn.freebsd.org> From: Davide Italiano Date: Sat, 30 Jun 2012 23:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237859 - in projects/calloutng/sys: conf kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 23:34:34 -0000 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 __FBSDID("$FreeBSD$"); +#include "opt_callout_profiling.h" #include "opt_kdtrace.h" #include @@ -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); }