MCPcopy Create free account
hub / github.com/F-Stack/f-stack / callout_callwheel_init

Function callout_callwheel_init

freebsd/kern/kern_timeout.c:271–308  ·  view source on GitHub ↗

* Kernel low level callwheel initialization * called on the BSP during kernel startup. */

Source from the content-addressed store, hash-verified

269 * called on the BSP during kernel startup.
270 */
271static void
272callout_callwheel_init(void *dummy)
273{
274 struct callout_cpu *cc;
275 int cpu;
276
277 /*
278 * Calculate the size of the callout wheel and the preallocated
279 * timeout() structures.
280 * XXX: Clip callout to result of previous function of maxusers
281 * maximum 384. This is still huge, but acceptable.
282 */
283 ncallout = imin(16 + maxproc + maxfiles, 18508);
284 TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
285
286 /*
287 * Calculate callout wheel size, should be next power of two higher
288 * than 'ncallout'.
289 */
290 callwheelsize = 1 << fls(ncallout);
291 callwheelmask = callwheelsize - 1;
292
293 /*
294 * Fetch whether we're pinning the swi's or not.
295 */
296 TUNABLE_INT_FETCH("kern.pin_default_swi", &pin_default_swi);
297 TUNABLE_INT_FETCH("kern.pin_pcpu_swi", &pin_pcpu_swi);
298
299 /*
300 * Initialize callout wheels. The software interrupt threads
301 * are created later.
302 */
303 cc_default_cpu = PCPU_GET(cpuid);
304 CPU_FOREACH(cpu) {
305 cc = CC_CPU(cpu);
306 callout_cpu_init(cc, cpu);
307 }
308}
309SYSINIT(callwheel_init, SI_SUB_CPU, SI_ORDER_ANY, callout_callwheel_init, NULL);
310
311/*

Callers

nothing calls this directly

Calls 3

iminFunction · 0.85
callout_cpu_initFunction · 0.70
flsFunction · 0.50

Tested by

no test coverage detected