diff options
author | Juri Lelli <juri.lelli@gmail.com> | 2011-11-24 15:46:40 +0100 |
---|---|---|
committer | Juri Lelli <juri.lelli@gmail.com> | 2011-11-24 15:46:40 +0100 |
commit | 522a3845ceeb5b6a42849a25f896a0feac6c0270 (patch) | |
tree | d30b428dbbf8da19c701fa078eddb0e1746148c6 | |
parent | 85051ce0e790b1820779a9ec15289b55d7e78d81 (diff) |
Updated to SCHED_DEADLINE V4.
-rw-r--r-- | libdl/dl_syscalls.c | 21 | ||||
-rw-r--r-- | libdl/dl_syscalls.h | 52 | ||||
-rw-r--r-- | src/rt-app.c | 14 | ||||
-rw-r--r-- | src/rt-app_types.h | 2 | ||||
-rw-r--r-- | src/rt-app_utils.c | 6 | ||||
-rw-r--r-- | src/rt-app_utils.h | 3 |
6 files changed, 50 insertions, 48 deletions
diff --git a/libdl/dl_syscalls.c b/libdl/dl_syscalls.c index 13941c9..0336614 100644 --- a/libdl/dl_syscalls.c +++ b/libdl/dl_syscalls.c @@ -1,23 +1,18 @@ #include "dl_syscalls.h" -int sched_setscheduler_ex(pid_t pid, int policy, unsigned len, - struct sched_param_ex *param) +int sched_setscheduler2(pid_t pid, int policy, + const struct sched_param2 *param) { - return syscall(__NR_sched_setscheduler_ex, pid, policy, len, param); + return syscall(__NR_sched_setscheduler2, pid, policy, param); } -int sched_setparam_ex(pid_t pid, unsigned len, struct sched_param_ex *param) +int sched_setparam2(pid_t pid, + const struct sched_param2 *param) { - return syscall(__NR_sched_setparam_ex, pid, len, param); + return syscall(__NR_sched_setparam2, pid, param); } -int sched_getparam_ex(pid_t pid, unsigned len, struct sched_param_ex *param) +int sched_getparam2(pid_t pid, struct sched_param2 *param) { - return syscall(__NR_sched_getparam_ex, pid, len, param); + return syscall(__NR_sched_getparam2, pid, param); } - -int sched_wait_interval_ex(const struct timespec *rqtp, struct timespec *rmtp) -{ - return syscall(__NR_sched_wait_interval, rqtp, rmtp); -} - diff --git a/libdl/dl_syscalls.h b/libdl/dl_syscalls.h index 8fd5393..a8ddc1a 100644 --- a/libdl/dl_syscalls.h +++ b/libdl/dl_syscalls.h @@ -25,51 +25,49 @@ /* XXX use the proper syscall numbers */ #ifdef __x86_64__ -#define __NR_sched_setscheduler_ex 300 -#define __NR_sched_setparam_ex 301 -#define __NR_sched_getparam_ex 302 -#define __NR_sched_wait_interval 303 +#define __NR_sched_setscheduler2 312 +#define __NR_sched_setparam2 313 +#define __NR_sched_getparam2 314 #endif #ifdef __i386__ -#define __NR_sched_setscheduler_ex 338 -#define __NR_sched_setparam_ex 339 -#define __NR_sched_getparam_ex 340 -#define __NR_sched_wait_interval 341 +#define __NR_sched_setscheduler2 349 +#define __NR_sched_setparam2 350 +#define __NR_sched_getparam2 351 #endif #ifdef __arm__ -#define __NR_sched_setscheduler_ex 366 -#define __NR_sched_setparam_ex 367 -#define __NR_sched_getparam_ex 368 -#define __NR_sched_wait_interval 369 +#define __NR_sched_setscheduler2 376 +#define __NR_sched_setparam2 377 +#define __NR_sched_getparam2 378 #endif -#define SCHED_SIG_RORUN 0x0001 -#define SCHED_SIG_DMISS 0x0002 -#define SCHED_BWRECL_DL 0x0004 -#define SCHED_BWRECL_RT 0x0008 -#define SCHED_BWRECL_OTH 0x0010 +#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 -struct sched_param_ex { +struct sched_param2 { int sched_priority; - struct timespec sched_runtime; - struct timespec sched_deadline; - struct timespec sched_period; unsigned int sched_flags; -}; + __u64 sched_runtime; + __u64 sched_deadline; + __u64 sched_period; -int sched_setscheduler_ex(pid_t pid, int policy, unsigned int len, - struct sched_param_ex *param); + __u64 __unused[12]; +}; -int sched_setparam_ex(pid_t pid, unsigned len, struct sched_param_ex *param); +int sched_setscheduler2(pid_t pid, int policy, + const struct sched_param2 *param); -int sched_getparam_ex(pid_t pid, unsigned len, struct sched_param_ex *param); +int sched_setparam2(pid_t pid, + const struct sched_param2 *param); -int sched_wait_interval(const struct timespec *rqtp, struct timespec *rmtp); +int sched_getparam2(pid_t pid, struct sched_param2 *param); #endif /* __DL_SYSCALLS__ */ diff --git a/src/rt-app.c b/src/rt-app.c index 215f8aa..2f0502e 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -173,16 +173,16 @@ void *thread_body(void *arg) case deadline: tid = gettid(); data->dl_params.sched_priority = data->sched_prio; - data->dl_params.sched_runtime = data->max_et; - data->dl_params.sched_deadline = data->period; - data->dl_params.sched_period = data->period; - data->dl_params.sched_flags = SCHED_BWRECL_RT; + data->dl_params.sched_runtime = timespec_to_nsec(&data->max_et); + data->dl_params.sched_deadline = timespec_to_nsec(&data->period); + data->dl_params.sched_period = timespec_to_nsec(&data->period); + /* not implemented inside SCHED_DEADLINE V4 */ + /* data->dl_params.sched_flags = SCHED_BWRECL_RT; */ - ret = sched_setscheduler_ex(tid, SCHED_DEADLINE, - sizeof(struct sched_param_ex), + ret = sched_setscheduler2(tid, SCHED_DEADLINE, &data->dl_params); if (ret != 0) { - log_critical("[%d] sched_setscheduler_ex" + log_critical("[%d] sched_setscheduler2" "returned %d", data->ind, ret); exit(EXIT_FAILURE); } diff --git a/src/rt-app_types.h b/src/rt-app_types.h index 8e33e93..7d503a2 100644 --- a/src/rt-app_types.h +++ b/src/rt-app_types.h @@ -98,7 +98,7 @@ typedef struct _thread_data_t { #endif #ifdef DLSCHED - struct sched_param_ex dl_params; + struct sched_param2 dl_params; #endif } thread_data_t; diff --git a/src/rt-app_utils.c b/src/rt-app_utils.c index 78f0031..46bb062 100644 --- a/src/rt-app_utils.c +++ b/src/rt-app_utils.c @@ -37,6 +37,12 @@ timespec_to_usec(struct timespec *ts) return round((ts->tv_sec * 1E9 + ts->tv_nsec) / 1000.0); } +unsigned long long +timespec_to_nsec(struct timespec *ts) +{ + return round(ts->tv_sec * 1E9 + ts->tv_nsec); +} + struct timespec usec_to_timespec(unsigned long usec) { diff --git a/src/rt-app_utils.h b/src/rt-app_utils.h index 19d5530..b09fa2d 100644 --- a/src/rt-app_utils.h +++ b/src/rt-app_utils.h @@ -81,6 +81,9 @@ timespec_to_lusec(struct timespec *ts); unsigned long timespec_to_usec(struct timespec *ts); +unsigned long long +timespec_to_nsec(struct timespec *ts); + struct timespec usec_to_timespec(unsigned long usec); |