diff options
| author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-10 16:21:07 -0500 |
|---|---|---|
| committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-10 16:21:07 -0500 |
| commit | 8d00682ce5ddaedfb62287773d21c727f08fda69 (patch) | |
| tree | 61a4b7bac5960c6f0ab25fe087404e9ca1725e05 /include/litmus/gpu_affinity.h | |
| parent | fdf0a6b73001976c5d02d631ebdd0927819d7c91 (diff) | |
| parent | 1235a665a5e00dc762e6646c01381b3ed5019d86 (diff) | |
Merge branch 'wip-gpu-cleanup' into wip-2012.3-gpu
Conflicts:
include/litmus/fpmath.h
include/litmus/litmus.h
include/litmus/rt_param.h
include/litmus/trace.h
kernel/sched.c
kernel/softirq.c
litmus/edf_common.c
litmus/jobs.c
litmus/litmus.c
litmus/locking.c
litmus/preempt.c
litmus/sched_cedf.c
litmus/sched_gsn_edf.c
litmus/sched_litmus.c
litmus/sync.c
Diffstat (limited to 'include/litmus/gpu_affinity.h')
| -rw-r--r-- | include/litmus/gpu_affinity.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/include/litmus/gpu_affinity.h b/include/litmus/gpu_affinity.h new file mode 100644 index 000000000000..47da725717b0 --- /dev/null +++ b/include/litmus/gpu_affinity.h | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | #ifndef LITMUS_GPU_AFFINITY_H | ||
| 2 | #define LITMUS_GPU_AFFINITY_H | ||
| 3 | |||
| 4 | #include <litmus/rt_param.h> | ||
| 5 | #include <litmus/sched_plugin.h> | ||
| 6 | #include <litmus/litmus.h> | ||
| 7 | |||
| 8 | void update_gpu_estimate(struct task_struct* t, lt_t observed); | ||
| 9 | gpu_migration_dist_t gpu_migration_distance(int a, int b); | ||
| 10 | |||
| 11 | static inline void reset_gpu_tracker(struct task_struct* t) | ||
| 12 | { | ||
| 13 | t->rt_param.accum_gpu_time = 0; | ||
| 14 | } | ||
| 15 | |||
| 16 | static inline void start_gpu_tracker(struct task_struct* t) | ||
| 17 | { | ||
| 18 | t->rt_param.gpu_time_stamp = litmus_clock(); | ||
| 19 | } | ||
| 20 | |||
| 21 | static inline void stop_gpu_tracker(struct task_struct* t) | ||
| 22 | { | ||
| 23 | lt_t now = litmus_clock(); | ||
| 24 | t->rt_param.accum_gpu_time += (now - t->rt_param.gpu_time_stamp); | ||
| 25 | } | ||
| 26 | |||
| 27 | static inline lt_t get_gpu_time(struct task_struct* t) | ||
| 28 | { | ||
| 29 | return t->rt_param.accum_gpu_time; | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline lt_t get_gpu_estimate(struct task_struct* t, gpu_migration_dist_t dist) | ||
| 33 | { | ||
| 34 | int i; | ||
| 35 | lt_t val; | ||
| 36 | |||
| 37 | if(dist == MIG_NONE) { | ||
| 38 | dist = MIG_LOCAL; | ||
| 39 | } | ||
| 40 | |||
| 41 | val = t->rt_param.gpu_migration_est[dist].avg; | ||
| 42 | for(i = dist-1; i >= 0; --i) { | ||
| 43 | if(t->rt_param.gpu_migration_est[i].avg > val) { | ||
| 44 | val = t->rt_param.gpu_migration_est[i].avg; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | #if 0 | ||
| 49 | // int i; | ||
| 50 | // fpbuf_t temp = _fp_to_integer(t->rt_param.gpu_migration_est[dist].est); | ||
| 51 | // lt_t val = (temp >= 0) ? temp : 0; // never allow negative estimates... | ||
| 52 | lt_t val = t->rt_param.gpu_migration_est[dist].avg; | ||
| 53 | |||
| 54 | // WARN_ON(temp < 0); | ||
| 55 | |||
| 56 | // lower-bound a distant migration to be at least equal to the level | ||
| 57 | // below it. | ||
| 58 | // for(i = dist-1; (val == 0) && (i >= MIG_LOCAL); --i) { | ||
| 59 | // val = _fp_to_integer(t->rt_param.gpu_migration_est[i].est); | ||
| 60 | // } | ||
| 61 | #endif | ||
| 62 | |||
| 63 | return ((val > 0) ? val : dist+1); | ||
| 64 | } | ||
| 65 | |||
| 66 | #endif | ||
