diff options
Diffstat (limited to 'include/litmus/gpu_affinity.h')
-rw-r--r-- | include/litmus/gpu_affinity.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/litmus/gpu_affinity.h b/include/litmus/gpu_affinity.h index c29ff3de997c..ca4d10b93203 100644 --- a/include/litmus/gpu_affinity.h +++ b/include/litmus/gpu_affinity.h | |||
@@ -31,9 +31,21 @@ 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 | lt_t val = _fp_to_integer(t->rt_param.gpu_migration_est[dist].est); | 34 | int i; |
35 | fpbuf_t temp = _fp_to_integer(t->rt_param.gpu_migration_est[dist].est); | ||
36 | lt_t val = (temp >= 0) ? temp : 0; // never allow negative estimates... | ||
35 | 37 | ||
36 | // minimum value is 1. | 38 | WARN_ON(temp < 0); |
39 | |||
40 | // lower-bound a distant migration to be at least equal to the level | ||
41 | // below it. | ||
42 | for(i = dist-1; (val == 0) && (i >= MIG_LOCAL); --i) { | ||
43 | val = _fp_to_integer(t->rt_param.gpu_migration_est[i].est); | ||
44 | } | ||
45 | |||
46 | // minimum value is 1 (val is 0 if we haven't run with local affinity yet) | ||
47 | // TODO: pick a better default min-value. 1 is too small. perhaps | ||
48 | // task execution time? | ||
37 | return ((val > 0) ? val : 1); | 49 | return ((val > 0) ? val : 1); |
38 | } | 50 | } |
39 | 51 | ||