Skip to content

Scheduler Periodic Work

include/sch/periodic_work.h View source View on GitHub
struct scheduler_periodic_work_linker_record (5 fields) source
§ char *name
§ void (*fn)(void)
§ union
§ time_ns_t time_interval
§ size_t period_interval

overloaded

§ size_t interval
struct scheduler_periodic_work (10 fields) source
§ char *name
§ void (*fn)(void)
§ cpu_id_t cpu

for which CPU?

§ union
§ struct
§ uint64_t last_period_ran
§ uint64_t period_interval
§ uint64_t expected_period
§ struct
§ time_ns_t last_time_ran
§ time_ns_t time_interval
§ time_ns_t expected_next_time
§ struct

generic struct - do not reorder members

§ size_t last_occurrence
§ size_t interval
§ size_t expected_next
§ size_t executed_times
§ time_ns_t interval_total_loss

irrelevant for non-time based work

all time lost from misses

§ size_t interval_latency

total_loss / executed_times

§ struct pairing_node pnode

ordered by expected_next

struct scheduler_periodic_work_limits (2 fields) source
§ size_t max_execs_per_call

per_call here is each time the works are invoked (together)

§ time_ns_t max_duration_per_call_ns
struct scheduler_periodic_work_percpu (7 fields) source
§ struct pairing_heap period_based_works[PERIODIC_WORK_MAX]
§ struct pairing_heap time_based_works[PERIODIC_WORK_MAX]
§ size_t period_based_work_count[PERIODIC_WORK_MAX]
§ size_t time_based_work_count[PERIODIC_WORK_MAX]
§ cpu_id_t cpu
§ bool executing
enum scheduler_periodic_work_prio (4 variants) source
§ PERIODIC_WORK_HIGH
§ PERIODIC_WORK_MID
§ PERIODIC_WORK_LOW
§ PERIODIC_WORK_MAX
enum scheduler_periodic_work_type (2 variants) source
§ PERIODIC_WORK_PERIOD_BASED
§ PERIODIC_WORK_TIME_BASED
void scheduler_periodic_work_init(void)
source
void scheduler_periodic_work_execute(enum scheduler_periodic_work_type type)
source
bool scheduler_in_periodic_work(void)
source

prevent irql_lower work execution recursion

#define SCHEDULER_PERIODIC_WORK_REGISTER(_fn, _type, _prio, _interval)
source
Expansion
#define SCHEDULER_PERIODIC_WORK_REGISTER(_fn, _type, _prio, _interval) \
    LINKER_SECTION_OBJECT(struct scheduler_periodic_work_linker_record, \
                          sched_periodic_work) \
    __spw_##_fn = {.name = #_fn, \
                   .fn = _fn, \
                   .type = _type, \
                   .interval = _interval, \
                   .prio = _prio}

SCHEDULER_PERIODIC_WORK_REGISTER_PER_PERIOD

Section titled “SCHEDULER_PERIODIC_WORK_REGISTER_PER_PERIOD”
#define SCHEDULER_PERIODIC_WORK_REGISTER_PER_PERIOD(_fn, _prio)
source