svn commit: r324731 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Wed Oct 18 22:00:46 UTC 2017


Author: mjg
Date: Wed Oct 18 22:00:44 2017
New Revision: 324731
URL: https://svnweb.freebsd.org/changeset/base/324731

Log:
  Don't take Giant for SMP status and cpu topology sysctls.
  
  Not only this lock doesn't play any role here, dirtying it slows down
  other things a little bit as giant-held checks (e.g. DROP_GIANT) are
  spread all over the kernel.
  
  MFC after:	1 week

Modified:
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_smp.c

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Wed Oct 18 21:08:35 2017	(r324730)
+++ head/sys/kern/sched_ule.c	Wed Oct 18 22:00:44 2017	(r324731)
@@ -2939,7 +2939,7 @@ SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_
 SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0,
     "Minimum load on remote CPU before we'll steal");
 SYSCTL_PROC(_kern_sched, OID_AUTO, topology_spec, CTLTYPE_STRING |
-    CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A",
+    CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A",
     "XML dump of detected CPU topology");
 #endif
 

Modified: head/sys/kern/subr_smp.c
==============================================================================
--- head/sys/kern/subr_smp.c	Wed Oct 18 21:08:35 2017	(r324730)
+++ head/sys/kern/subr_smp.c	Wed Oct 18 22:00:44 2017	(r324731)
@@ -84,8 +84,9 @@ SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLF
 SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxcpus,
     0, "Max number of CPUs that the system was compiled for.");
 
-SYSCTL_PROC(_kern_smp, OID_AUTO, active, CTLFLAG_RD | CTLTYPE_INT, NULL, 0,
-    sysctl_kern_smp_active, "I", "Indicates system is running in SMP mode");
+SYSCTL_PROC(_kern_smp, OID_AUTO, active, CTLFLAG_RD|CTLTYPE_INT|CTLFLAG_MPSAFE,
+    NULL, 0, sysctl_kern_smp_active, "I",
+    "Indicates system is running in SMP mode");
 
 int smp_disabled = 0;	/* has smp been disabled? */
 SYSCTL_INT(_kern_smp, OID_AUTO, disabled, CTLFLAG_RDTUN|CTLFLAG_CAPRD,


More information about the svn-src-all mailing list