From c69a1a50cd13a8ef705ece1748bd93b7474cfee1 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Wed, 18 Oct 2017 22:00:44 +0000 Subject: [PATCH] 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 --- sys/kern/sched_ule.c | 2 +- sys/kern/subr_smp.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index a4d0a040297e..c6889ccd9332 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2939,7 +2939,7 @@ SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_RW, &steal_idle, 0, 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 diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 81e11ee70e73..108705c98a25 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -84,8 +84,9 @@ SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxid, 0, 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,