Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2009 12:03:43 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192304 - head/sys/kern
Message-ID:  <200905181203.n4IC3hwc061368@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Mon May 18 12:03:43 2009
New Revision: 192304
URL: http://svn.freebsd.org/changeset/base/192304

Log:
  Mark the clock sysctls as MPSAFE.
  
  These sysctls don't need any form of locking. At least cp_times is used
  by powerd very often, which means I get 50% less calls to non-MPSAFE
  sysctls on my system. The other 50% is consumed by dev.cpu.0.freq, but
  this seems to need Giant for Newbus.

Modified:
  head/sys/kern/kern_clock.c

Modified: head/sys/kern/kern_clock.c
==============================================================================
--- head/sys/kern/kern_clock.c	Mon May 18 11:23:15 2009	(r192303)
+++ head/sys/kern/kern_clock.c	Mon May 18 12:03:43 2009	(r192304)
@@ -112,7 +112,7 @@ sysctl_kern_cp_time(SYSCTL_HANDLER_ARGS)
 	return error;
 }
 
-SYSCTL_PROC(_kern, OID_AUTO, cp_time, CTLTYPE_LONG|CTLFLAG_RD,
+SYSCTL_PROC(_kern, OID_AUTO, cp_time, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE,
     0,0, sysctl_kern_cp_time, "LU", "CPU time statistics");
 
 static long empty[CPUSTATES];
@@ -156,7 +156,7 @@ sysctl_kern_cp_times(SYSCTL_HANDLER_ARGS
 	return error;
 }
 
-SYSCTL_PROC(_kern, OID_AUTO, cp_times, CTLTYPE_LONG|CTLFLAG_RD,
+SYSCTL_PROC(_kern, OID_AUTO, cp_times, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE,
     0,0, sysctl_kern_cp_times, "LU", "per-CPU time statistics");
 
 void
@@ -559,7 +559,8 @@ sysctl_kern_clockrate(SYSCTL_HANDLER_ARG
 	return (sysctl_handle_opaque(oidp, &clkinfo, sizeof clkinfo, req));
 }
 
-SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
+SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate,
+	CTLTYPE_STRUCT|CTLFLAG_RD|CTLFLAG_MPSAFE,
 	0, 0, sysctl_kern_clockrate, "S,clockinfo",
 	"Rate and period of various kernel clocks");
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905181203.n4IC3hwc061368>