Page MenuHomeFreeBSD

D61361.1795976306.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61361.1795976306.diff

diff --git a/share/man/man9/callout.9 b/share/man/man9/callout.9
--- a/share/man/man9/callout.9
+++ b/share/man/man9/callout.9
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd September 18, 2026
+.Dd November 13, 2026
.Dt CALLOUT 9
.Os
.Sh NAME
@@ -455,8 +455,14 @@
The callout subsystem provides a softclock thread for each CPU in the system.
Callouts are assigned to a single CPU and are executed by the softclock thread
for that CPU.
-Initially,
+By default,
callouts are assigned to CPU 0.
+If the
+.Va kern.callout_spread
+sysctl is set to a non-zero value,
+callouts initialized after SMP startup are distributed among CPUs.
+This sysctl is also a loader tunable and defaults to zero.
+Changing it does not reassign existing callouts.
The
.Fn callout_reset_on ,
.Fn callout_reset_sbt_on ,
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -110,6 +110,11 @@
SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &ncallout, 0,
"Number of entries in callwheel and size of timeout() preallocation");
+static bool __read_mostly callout_spread;
+SYSCTL_BOOL(_kern, OID_AUTO, callout_spread, CTLFLAG_RWTUN,
+ &callout_spread, 0,
+ "Distribute initial callout CPU assignments after SMP startup");
+
#ifdef RSS
static int pin_default_swi = 1;
static int pin_pcpu_swi = 1;
@@ -1357,7 +1362,7 @@
c->c_lock = &Giant.lock_object;
c->c_iflags = 0;
}
- c->c_cpu = cc_default_cpu;
+ c->c_cpu = callout_spread ? curcpu : cc_default_cpu;
}
void
@@ -1377,7 +1382,7 @@
*c = (struct callout ){
.c_lock = lock,
.c_iflags = flags,
- .c_cpu = cc_default_cpu,
+ .c_cpu = callout_spread ? curcpu : cc_default_cpu,
};
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 29, 6:18 PM (23 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42094120
Default Alt Text
D61361.1795976306.diff (1 KB)

Event Timeline