37 if (
strcmp(info->name, arg) == 0)
41 pr_dinfo2(scheduler,
"active scheduler: %s", info->name);
46 pr_dwarn(scheduler,
"scheduler '%s' not found", arg);
54 pr_dwarn(scheduler,
"no scheduler is selected, using the first scheduler");
62 pr_dinfo2(scheduler,
"unblocking scheduler");
103 pr_dinfo2(scheduler,
"waking up %pt", (
void *) thread);
136 if (should_switch_mm)
170 pr_dinfo2(scheduler,
"%pt is now blocked", (
void *) t);
#define MOS_ASSERT_X(cond, msg,...)
#define MOS_UNREACHABLE()
MOSAPI s32 strcmp(const char *str1, const char *str2)
__nodiscard mm_context_t * mm_switch_context(mm_context_t *new_ctx)
#define statement_expr(type,...)
#define pr_dinfo2(feat, fmt,...)
#define pr_dwarn(feat, fmt,...)
void blocked_reschedule(void)
Mark the current task as blocked and reschedule.
bool reschedule_for_waitlist(waitlist_t *waitlist)
void unblock_scheduler(void)
Unblock the scheduler, so that APs can start scheduling.
void enter_scheduler(void)
Enter the scheduler and switch to the next thread.
void scheduler_wake_thread(thread_t *thread)
Wake a thread.
void reschedule(void)
reschedule.
char thread_state_str(thread_state_t state)
static bool scheduler_ready
const scheduler_info_t __MOS_SCHEDULERS_END[]
void scheduler_add_thread(thread_t *thread)
Add a thread to the scheduler, so that it can be scheduled.
const scheduler_info_t __MOS_SCHEDULERS_START[]
static scheduler_t * active_scheduler
void scheduler_remove_thread(thread_t *thread)
Remove a thread from the scheduler.
#define MOS_SETUP(_param, _fn)
should_inline bool spinlock_is_locked(const spinlock_t *lock)
#define spinlock_acquire(lock)
#define spinlock_release(lock)
mm_context_t * mm_context
thread_t * idle_thread
idle thread for this CPU
scheduler_t *const scheduler
void(* remove_thread)(scheduler_t *instance, thread_t *thread)
Remove a thread from the scheduler.
void(* init)(scheduler_t *instance)
Initialize the scheduler.
thread_t *(* select_next)(scheduler_t *instance)
Select the next thread to run, thread state lock should be locked.
void(* add_thread)(scheduler_t *instance, thread_t *thread)
Add a thread to the scheduler.
const scheduler_ops_t * ops
thread_mode mode
user-mode thread or kernel-mode
spinlock_t state_lock
protects the thread state
thread_state_t state
thread state
should_inline bool thread_is_valid(const thread_t *thread)
__nodiscard bool waitlist_append(waitlist_t *list)