Usage
Usage Instructions
Bandwidth Management
Scheduling domain wide bandwidth management for SCHED_DEADLINE is affected by the two following tunables:
/proc/sys/kernel/sched_deadline_period_us
/proc/sys/kernel/sched_deadline_runtime_us
Setup these values so that runtime/period is the amount of CPU (of each CPU of the system, actually) you want your SCHED_DEADLINE tasks to be able to explot.
Disabling Bandwidth Management
Just issue a echo -1 > /proc/sys/kernel/sched_deadline_runtime_us
API
#define SCHED_DEADLINE 6
#define SF_SIG_RORUN 2
#define SF_SIG_DMISS 4
#define SF_BWRECL_DL 8
#define SF_BWRECL_RT 16
#define SF_BWRECL_NR 32
struct sched_param_ex {
int sched_priority;
struct timespec sched_runtime;
struct timespec sched_deadline;
struct timespec sched_period
int sched_flags;;
struct timespec curr_runtime;
struct timespec used_runtime;
struct timespec curr_deadline;
};
int sched_setscheduler_ex(pid_t pid, int policy, unsigned int len, struct sched_param_ex *param);
int_sched_setparam_ex(pid_t pid, unsigned int, struct sched_param_ex *param);
int sched_getparam_ex(pid_t pid, unsigned int, struct sched_param_ex *param);
int sched_wait_interval(int flags, const struct timespec *rqtp, struct timespec *rmtp);
Example Code
...
struct sched_param_ex sched_edfp;
memset(&sched_edfp, 0, sizeof(sched_edfp));
sched_edfp.sched_priority = 0;
sched_edfp.sched_deadline = time_to_timespec(<deadline>);
sched_edfp.sched_runtime = time_to_timespec(<wcet>);
sched_edfp.sched_flags = 0;
mask = 0x1 << which_cpu;
sched_setaffinity(0, sizeof(mask), &mask);
sched_setscheduler_ex(0, SCHED_DEADLINE, sizeof(sched_edfp), &sched_edfp);
fprintf(stderr, "task %d: START\n", gettid());
clock_gettime(CLOCK_MONOTONIC, &next);
next.tv_sec++;
while (<!end>) {
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &next, NULL);
nrun++;
printf("task %d: running cycle %d\n", pid, nrun);
<do your job!>
next = timespec_add(next, <period>);
}
...
Binary Usage
Setup 50% bandwidth available for SCHED_DEADLINE tasks:
echo 500000 > /proc/sys/kernel/sched_rt_runtime_us
echo 100000 > /proc/sys/kernel/sched_dl_period_us
echo 50000 > /proc/sys/kernel/sched_dl_runtime_us
Run a new task as SCHED_DEADLINE or make a running task SCHED_DEADLINE:
schedtool -E -t _runtime_:_deadline_ [-a _#CPU_] [-s] [-S] -e _command_
schedtool -E -t _runtime_:_deadline_ [-a _#CPU_] [-s] [-S] _pid_
Back to Homepage
Created by Dario Faggioli, C 2009, 2010, 2011

