diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/litmus/gpu_affinity.h | 26 | ||||
| -rw-r--r-- | include/litmus/rt_param.h | 77 | ||||
| -rw-r--r-- | include/litmus/unistd_32.h | 5 | ||||
| -rw-r--r-- | include/litmus/unistd_64.h | 7 |
4 files changed, 88 insertions, 27 deletions
diff --git a/include/litmus/gpu_affinity.h b/include/litmus/gpu_affinity.h index d64a15cbf2a5..a2abc4c1fd7c 100644 --- a/include/litmus/gpu_affinity.h +++ b/include/litmus/gpu_affinity.h | |||
| @@ -31,18 +31,20 @@ static inline lt_t get_gpu_time(struct task_struct* t) | |||
| 31 | 31 | ||
| 32 | static inline lt_t get_gpu_estimate(struct task_struct* t, gpu_migration_dist_t dist) | 32 | static inline lt_t get_gpu_estimate(struct task_struct* t, gpu_migration_dist_t dist) |
| 33 | { | 33 | { |
| 34 | // int i; | 34 | lt_t val = 0; |
| 35 | // fpbuf_t temp = _fp_to_integer(t->rt_param.gpu_migration_est[dist].est); | 35 | |
| 36 | // lt_t val = (temp >= 0) ? temp : 0; // never allow negative estimates... | 36 | switch(t->rt_param.prediction_mode) { |
| 37 | lt_t val = t->rt_param.gpu_migration_est[dist].avg; | 37 | case SIMPLE_AVG: |
| 38 | 38 | case CC_BRUTE_AVG: | |
| 39 | // WARN_ON(temp < 0); | 39 | case CC_MR_AVG: |
| 40 | 40 | val = t->rt_param.gpu_avg_est[dist].center_line; | |
| 41 | // lower-bound a distant migration to be at least equal to the level | 41 | break; |
| 42 | // below it. | 42 | case SIMPLE_EWMA: |
| 43 | // for(i = dist-1; (val == 0) && (i >= MIG_LOCAL); --i) { | 43 | case CC_BRUTE_EWMA: |
| 44 | // val = _fp_to_integer(t->rt_param.gpu_migration_est[i].est); | 44 | case CC_MR_EWMA: |
| 45 | // } | 45 | val = t->rt_param.gpu_ewma_est[dist].center_line; |
| 46 | break; | ||
| 47 | } | ||
| 46 | 48 | ||
| 47 | return ((val > 0) ? val : dist+1); | 49 | return ((val > 0) ? val : dist+1); |
| 48 | } | 50 | } |
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 44f85a366574..6da36f50240d 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
| @@ -41,6 +41,32 @@ typedef enum { | |||
| 41 | PRECISE_SIGNALS, /* budget signals are triggered with hrtimers */ | 41 | PRECISE_SIGNALS, /* budget signals are triggered with hrtimers */ |
| 42 | } budget_signal_policy_t; | 42 | } budget_signal_policy_t; |
| 43 | 43 | ||
| 44 | typedef enum | ||
| 45 | { | ||
| 46 | /* simple - all observations counted */ | ||
| 47 | SIMPLE_AVG = 1, | ||
| 48 | SIMPLE_EWMA, | ||
| 49 | |||
| 50 | /* control chart, brute - std deviation fully calculated */ | ||
| 51 | CC_BRUTE_AVG, | ||
| 52 | CC_BRUTE_EWMA, | ||
| 53 | |||
| 54 | /* control chart, moving range - std deviation est. from moving range */ | ||
| 55 | CC_MR_AVG, | ||
| 56 | CC_MR_EWMA, | ||
| 57 | } predictor_type; | ||
| 58 | |||
| 59 | typedef struct predictor | ||
| 60 | { | ||
| 61 | predictor_type type; | ||
| 62 | uint16_t window_size; | ||
| 63 | |||
| 64 | uint8_t sigmas; | ||
| 65 | uint16_t alpha_num; | ||
| 66 | uint16_t alpha_denom; | ||
| 67 | } predictor_t; | ||
| 68 | |||
| 69 | |||
| 44 | /* We use the common priority interpretation "lower index == higher priority", | 70 | /* We use the common priority interpretation "lower index == higher priority", |
| 45 | * which is commonly used in fixed-priority schedulability analysis papers. | 71 | * which is commonly used in fixed-priority schedulability analysis papers. |
| 46 | * So, a numerically lower priority value implies higher scheduling priority, | 72 | * So, a numerically lower priority value implies higher scheduling priority, |
| @@ -180,23 +206,48 @@ typedef enum gpu_migration_dist | |||
| 180 | MIG_LAST = MIG_NONE | 206 | MIG_LAST = MIG_NONE |
| 181 | } gpu_migration_dist_t; | 207 | } gpu_migration_dist_t; |
| 182 | 208 | ||
| 183 | typedef struct feedback_est{ | ||
| 184 | fp_t est; | ||
| 185 | fp_t accum_err; | ||
| 186 | } feedback_est_t; | ||
| 187 | |||
| 188 | |||
| 189 | #define AVG_EST_WINDOW_SIZE 20 | 209 | #define AVG_EST_WINDOW_SIZE 20 |
| 190 | 210 | ||
| 191 | typedef struct avg_est{ | 211 | typedef struct obs_history |
| 192 | lt_t history[AVG_EST_WINDOW_SIZE]; | 212 | { |
| 213 | uint16_t window_size; | ||
| 193 | uint16_t count; | 214 | uint16_t count; |
| 194 | uint16_t idx; | 215 | uint16_t idx; |
| 216 | uint16_t ridx; | ||
| 217 | |||
| 218 | lt_t last_observed; | ||
| 219 | lt_t *observations; | ||
| 220 | lt_t *range; | ||
| 221 | } obs_history_t; | ||
| 222 | |||
| 223 | typedef struct avg_est { | ||
| 224 | uint8_t sigmas; | ||
| 225 | |||
| 226 | obs_history_t history; | ||
| 227 | |||
| 195 | lt_t sum; | 228 | lt_t sum; |
| 229 | lt_t rsum; | ||
| 230 | |||
| 196 | lt_t std; | 231 | lt_t std; |
| 197 | lt_t avg; | 232 | lt_t center_line; |
| 198 | } avg_est_t; | 233 | } avg_est_t; |
| 199 | 234 | ||
| 235 | |||
| 236 | typedef struct ewma_est { | ||
| 237 | uint8_t sigmas; | ||
| 238 | uint16_t alpha_num; | ||
| 239 | uint16_t alpha_denom; | ||
| 240 | |||
| 241 | obs_history_t history; | ||
| 242 | |||
| 243 | lt_t rsum; | ||
| 244 | |||
| 245 | lt_t std; | ||
| 246 | lt_t center_line; | ||
| 247 | } ewma_est_t; | ||
| 248 | |||
| 249 | |||
| 250 | |||
| 200 | /* RT task parameters for scheduling extensions | 251 | /* RT task parameters for scheduling extensions |
| 201 | * These parameters are inherited during clone and therefore must | 252 | * These parameters are inherited during clone and therefore must |
| 202 | * be explicitly set up before the task set is launched. | 253 | * be explicitly set up before the task set is launched. |
| @@ -243,7 +294,13 @@ struct rt_param { | |||
| 243 | long unsigned int held_gpus; // bitmap of held GPUs. | 294 | long unsigned int held_gpus; // bitmap of held GPUs. |
| 244 | 295 | ||
| 245 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING | 296 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING |
| 246 | avg_est_t gpu_migration_est[MIG_LAST+1]; | 297 | // avg_est_t gpu_migration_est[MIG_LAST+1]; |
| 298 | predictor_type prediction_mode; | ||
| 299 | union | ||
| 300 | { | ||
| 301 | avg_est_t gpu_avg_est[MIG_LAST+1]; | ||
| 302 | ewma_est_t gpu_ewma_est[MIG_LAST+1]; | ||
| 303 | }; | ||
| 247 | 304 | ||
| 248 | gpu_migration_dist_t gpu_migration; | 305 | gpu_migration_dist_t gpu_migration; |
| 249 | int last_gpu; | 306 | int last_gpu; |
diff --git a/include/litmus/unistd_32.h b/include/litmus/unistd_32.h index c86b743408ed..964f02082275 100644 --- a/include/litmus/unistd_32.h +++ b/include/litmus/unistd_32.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #define __NR_litmus_dgl_unlock __LSC(13) | 21 | #define __NR_litmus_dgl_unlock __LSC(13) |
| 22 | #define __NR_register_nv_device __LSC(14) | 22 | #define __NR_register_nv_device __LSC(14) |
| 23 | 23 | ||
| 24 | #define __NR_set_aux_tasks _LSC(15) | 24 | #define __NR_config_gpu_affinity_predictor __LSC(15) |
| 25 | #define __NR_set_aux_tasks _LSC(16) | ||
| 25 | 26 | ||
| 26 | #define NR_litmus_syscalls 16 | 27 | #define NR_litmus_syscalls 17 |
diff --git a/include/litmus/unistd_64.h b/include/litmus/unistd_64.h index 3825bc129dbd..70be98d4f1e7 100644 --- a/include/litmus/unistd_64.h +++ b/include/litmus/unistd_64.h | |||
| @@ -35,8 +35,9 @@ __SYSCALL(__NR_litmus_dgl_lock, sys_litmus_dgl_lock) | |||
| 35 | __SYSCALL(__NR_litmus_dgl_unlock, sys_litmus_dgl_unlock) | 35 | __SYSCALL(__NR_litmus_dgl_unlock, sys_litmus_dgl_unlock) |
| 36 | #define __NR_register_nv_device __LSC(14) | 36 | #define __NR_register_nv_device __LSC(14) |
| 37 | __SYSCALL(__NR_register_nv_device, sys_register_nv_device) | 37 | __SYSCALL(__NR_register_nv_device, sys_register_nv_device) |
| 38 | 38 | #define __NR_config_gpu_affinity_predictor __LSC(15) | |
| 39 | #define __NR_set_aux_tasks __LSC(15) | 39 | __SYSCALL(__NR_config_gpu_affinity_predictor, sys_config_gpu_affinity_predictor) |
| 40 | #define __NR_set_aux_tasks __LSC(16) | ||
| 40 | __SYSCALL(__NR_set_aux_tasks, sys_set_aux_tasks) | 41 | __SYSCALL(__NR_set_aux_tasks, sys_set_aux_tasks) |
| 41 | 42 | ||
| 42 | #define NR_litmus_syscalls 16 | 43 | #define NR_litmus_syscalls 17 |
