Skip to content

Commit

Permalink
rt-app: add support for SCHED_DEADLINE bandwidth reclaiming
Browse files Browse the repository at this point in the history
Mainline got support for SCHED_DEADLINE bandwidth reclaming.

Make that feature available to rt-app.

Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
  • Loading branch information
jlelli committed Jun 5, 2018
1 parent 3901636 commit cc4a31b
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 8 deletions.
27 changes: 27 additions & 0 deletions doc/examples/deadline.json
@@ -0,0 +1,27 @@
{
/*
* Simple use case which creates 10% load
* until the use case is stopped with Ctrl+C
*/
"tasks" : {
"thread0" : {
"instance" : 1,
"loop" : -1,
"run" : 10000,
"timer" : { "ref" : "unique", "period" : 100000 },
"dl-runtime" : 12000,
"dl-period" : 100000,
}
},
"global" : {
"duration" : 2,
"calibration" : "CPU0",
"default_policy" : "SCHED_DEADLINE",
"pi_enabled" : false,
"lock_pages" : false,
"logdir" : "./",
"log_basename" : "rt-app2",
"ftrace" : true,
"gnuplot" : false
}
}
28 changes: 28 additions & 0 deletions doc/examples/deadline_no_reclaim-1.json
@@ -0,0 +1,28 @@
{
/*
* Simple use case which creates 10% load
* until the use case is stopped with Ctrl+C
*/
"tasks" : {
"thread0" : {
"instance" : 1,
"loop" : -1,
"run" : 15000,
"timer" : { "ref" : "unique", "period" : 100000 },
"dl-runtime" : 12000,
"dl-period" : 100000,
"dl-reclaim" : false
}
},
"global" : {
"duration" : 2,
"calibration" : "CPU0",
"default_policy" : "SCHED_DEADLINE",
"pi_enabled" : false,
"lock_pages" : false,
"logdir" : "./",
"log_basename" : "rt-app2",
"ftrace" : true,
"gnuplot" : false
}
}
28 changes: 28 additions & 0 deletions doc/examples/deadline_reclaim-1.json
@@ -0,0 +1,28 @@
{
/*
* Simple use case which creates 10% load
* until the use case is stopped with Ctrl+C
*/
"tasks" : {
"thread0" : {
"instance" : 1,
"loop" : -1,
"run" : 15000,
"timer" : { "ref" : "unique", "period" : 100000 },
"dl-runtime" : 12000,
"dl-period" : 100000,
"dl-reclaim" : true
}
},
"global" : {
"duration" : 2,
"calibration" : "CPU0",
"default_policy" : "SCHED_DEADLINE",
"pi_enabled" : false,
"lock_pages" : false,
"logdir" : "./",
"log_basename" : "rt-app2",
"ftrace" : true,
"gnuplot" : false
}
}
9 changes: 1 addition & 8 deletions libdl/dl_syscalls.h
Expand Up @@ -65,14 +65,7 @@
#endif
#endif

#define SF_SIG_RORUN 2
#define SF_SIG_DMISS 4
#define SF_BWRECL_DL 8
#define SF_BWRECL_RT 16
#define SF_BWRECL_OTH 32

#define RLIMIT_DLDLINE 16
#define RLIMIT_DLRTIME 17
#define SCHED_FLAG_RECLAIM 0x02

struct sched_attr {
__u32 size;
Expand Down
3 changes: 3 additions & 0 deletions src/rt-app.c
Expand Up @@ -679,6 +679,9 @@ static void set_thread_priority(thread_data_t *data, sched_data_t *sched_data)
dl_params.sched_deadline = sched_data->deadline;
dl_params.sched_period = sched_data->period;

if (sched_data->reclaim)
dl_params.sched_flags |= SCHED_FLAG_RECLAIM;

ret = sched_setattr(tid, &dl_params, flags);
if (ret != 0) {
log_critical("[%d] sched_setattr "
Expand Down
1 change: 1 addition & 0 deletions src/rt-app_parse_config.c
Expand Up @@ -718,6 +718,7 @@ static sched_data_t *parse_sched_data(struct json_object *obj, int def_policy)
tmp_data.runtime = get_int_value_from(obj, "dl-runtime", TRUE, 0);
tmp_data.period = get_int_value_from(obj, "dl-period", TRUE, tmp_data.runtime);
tmp_data.deadline = get_int_value_from(obj, "dl-deadline", TRUE, tmp_data.period);
tmp_data.reclaim = get_bool_value_from(obj, "dl-reclaim", TRUE, 0);


if (def_policy != -1) {
Expand Down
1 change: 1 addition & 0 deletions src/rt-app_types.h
Expand Up @@ -154,6 +154,7 @@ typedef struct _sched_data_t {
unsigned long runtime;
unsigned long deadline;
unsigned long period;
int reclaim;
} sched_data_t;

typedef struct _phase_data_t {
Expand Down

0 comments on commit cc4a31b

Please sign in to comment.