HomeFreeBSD

runq: New runq_findq(), common low-level search implementation

Description

runq: New runq_findq(), common low-level search implementation

That new runq_findq(), based on the implementation of the former
runq_findq_range(), is intended to become the foundation and unique
low-level implementation for all searches in a runqueue. In addition to
a range of queues' indices, it takes a predicate function, allowing to:

  • Possibly skip a non-empty queue with higher priority (numerically lower index) on some criteria. This is not yet used but will be in a subsequent commit revising ULE's stealing machinery.
  • Choose a specific thread in the queue, not necessarily the first.
  • Return whatever information is deemed necessary.

It helps to remove duplicated boilerplate code, including redundant
assertions, and generally makes things much clearer. These effects will
be even greater in a subsequent commit modifying ULE to use it.

runq_first_thread_range() replaces the old runq_findq_range() (returns
the first thread of the highest priority queue in the requested range),
and runq_first_thread() the old runq_findq() (same, but considering all
queues).

Reviewed by: kib
MFC after: 1 month
Event: Kitchener-Waterloo Hackathon 202506
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45387

Details

Provenance
olceAuthored on Apr 26 2024, 1:57 AM
Reviewer
kib
Differential Revision
D45387: runq: API rationalization, code factorization, revised implementation
Parents
rGa31193172cb9: runq: New function runq_is_queue_empty(); Use it in ULE
Branches
Unknown
Tags
Unknown