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

Function runq_findbit_from

freebsd/kern/kern_switch.c:315–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315static __inline int
316runq_findbit_from(struct runq *rq, u_char pri)
317{
318 struct rqbits *rqb;
319 rqb_word_t mask;
320 int i;
321
322 /*
323 * Set the mask for the first word so we ignore priorities before 'pri'.
324 */
325 mask = (rqb_word_t)-1 << (pri & (RQB_BPW - 1));
326 rqb = &rq->rq_status;
327again:
328 for (i = RQB_WORD(pri); i < RQB_LEN; mask = -1, i++) {
329 mask = rqb->rqb_bits[i] & mask;
330 if (mask == 0)
331 continue;
332 pri = RQB_FFS(mask) + (i << RQB_L2BPW);
333 CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d pri=%d",
334 mask, i, pri);
335 return (pri);
336 }
337 if (pri == 0)
338 return (-1);
339 /*
340 * Wrap back around to the beginning of the list just once so we
341 * scan the whole thing.
342 */
343 pri = 0;
344 goto again;
345}
346
347/*
348 * Set the status bit of the queue corresponding to priority level pri,

Callers 1

runq_choose_fromFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected