* Kernel low level callwheel initialization * called on the BSP during kernel startup. */
| 269 | * called on the BSP during kernel startup. |
| 270 | */ |
| 271 | static void |
| 272 | callout_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 | } |
| 309 | SYSINIT(callwheel_init, SI_SUB_CPU, SI_ORDER_ANY, callout_callwheel_init, NULL); |
| 310 | |
| 311 | /* |
nothing calls this directly
no test coverage detected