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

Function callout_cpu_init

lib/ff_kern_timeout.c:269–295  ·  view source on GitHub ↗

* Initialize the per-cpu callout structures. */

Source from the content-addressed store, hash-verified

267 * Initialize the per-cpu callout structures.
268 */
269static void
270callout_cpu_init(struct callout_cpu *cc, int cpu)
271{
272 struct callout *c;
273 int i;
274
275 mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE);
276 SLIST_INIT(&cc->cc_callfree);
277 cc->cc_inited = 1;
278 cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize,
279 M_CALLOUT, M_WAITOK);
280 for (i = 0; i < callwheelsize; i++)
281 LIST_INIT(&cc->cc_callwheel[i]);
282 TAILQ_INIT(&cc->cc_expireq);
283 for (i = 0; i < 2; i++)
284 cc_cce_cleanup(cc, i);
285 snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name),
286 "callwheel cpu %d", cpu);
287 if (cc->cc_callout == NULL) /* Only cpu0 handles timeout(9) */
288 return;
289 for (i = 0; i < ncallout; i++) {
290 c = &cc->cc_callout[i];
291 callout_init(c, 0);
292 c->c_iflags = CALLOUT_LOCAL_ALLOC;
293 SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle);
294 }
295}
296
297static inline u_int
298callout_get_bucket(int to_ticks)

Callers 1

callout_callwheel_initFunction · 0.70

Calls 5

mtx_initFunction · 0.85
mallocFunction · 0.85
snprintfFunction · 0.85
cc_cce_cleanupFunction · 0.70
callout_initFunction · 0.70

Tested by

no test coverage detected