blob: 8e426a71f03df2aa5bbe9a340f70a0d694d27fcb (
plain) (
tree)
|
|
#ifndef _LITMUS_BUDGET_H_
#define _LITMUS_BUDGET_H_
#include <linux/hrtimer.h>
#include <linux/semaphore.h>
struct enforcement_timer
{
raw_spinlock_t lock;
struct hrtimer timer;
int armed:1;
};
typedef void (*scheduled_t)(struct task_struct* t);
typedef void (*blocked_t)(struct task_struct* t);
typedef void (*preempt_t)(struct task_struct* t);
typedef void (*sleep_t)(struct task_struct* t);
typedef enum hrtimer_restart (*exhausted_t)(struct task_struct* t);
typedef void (*exit_t)(struct task_struct* t);
typedef void (*inherit_t)(struct task_struct* t, struct task_struct* prio_inh);
typedef void (*disinherit_t)(struct task_struct* t, struct task_struct* prio_inh);
struct budget_tracker_ops
{
scheduled_t on_scheduled; /* called from litmus_schedule(). */
blocked_t on_blocked; /* called from plugin::schedule() */
preempt_t on_preempt; /* called from plugin::schedule() */
sleep_t on_sleep; /* called from plugin::schedule() */
exit_t on_exit; /* task exiting rt mode */
exhausted_t on_exhausted; /* called by plugin::tick() or timer interrupt */
inherit_t on_inherit;
disinherit_t on_disinherit;
};
struct budget_tracker
{
struct enforcement_timer timer;
const struct budget_tracker_ops* ops;
unsigned long flags;
};
/* budget tracker flags */
enum BT_FLAGS
{
BTF_BUDGET_EXHAUSTED = 0,
BTF_SIG_BUDGET_SENT = 1,
};
/* Functions for simple DRAIN_SIMPLE policy common
* to every scheduler. Scheduler must provide
* implementation for simple_on_exhausted().
*/
void simple_on_scheduled(struct task_struct* t);
void simple_on_blocked(struct task_struct* t);
void simple_on_preempt(struct task_struct* t);
void simple_on_sleep(struct task_struct* t);
void simple_on_exit(struct task_struct* t);
/* Functions for DRAIN_SOBLIV policy common
* to every scheduler. Scheduler must provide
* implementation for sobliv_on_exhausted().
*
* Limitation: Quantum budget tracking is unsupported.
*/
void sobliv_on_scheduled(struct task_struct* t);
void sobliv_on_blocked(struct task_struct* t);
void sobliv_on_sleep(struct task_struct* t);
/* Use the DRAIN_SIMPLE implementations */
#define sobliv_on_preempt simple_on_preempt
#define sobliv_on_exit simple_on_exit
void sobliv_on_inherit(struct task_struct* t, struct task_struct* prio_inh);
void sobliv_on_disinherit(struct task_struct* t, struct task_struct* prio_inh);
void sobliv_revaluate_task(struct task_struct* t);
void init_budget_tracker(struct budget_tracker* bt,
const struct budget_tracker_ops* ops);
/* Send SIG_BUDGET to a real-time task. */
void send_sigbudget(struct task_struct* t);
#endif
|