aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-04-26 15:35:35 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2013-04-26 15:35:35 -0400
commitdbb8d081e562fa5f2976903246823ac43bb8689d (patch)
treede2decb8a8086a226b244672405ae7808e489c58
parent01b6745cf326ac316eef0b02e9f01f16a74298ae (diff)
Tweak gpu heuristics
-rw-r--r--include/litmus/trace.h3
-rw-r--r--litmus/gpu_affinity.c19
2 files changed, 10 insertions, 12 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h
index 15bd645d2466..f10d8a0311cc 100644
--- a/include/litmus/trace.h
+++ b/include/litmus/trace.h
@@ -167,4 +167,7 @@ feather_callback void save_timestamp_hide_irq(unsigned long event);
167 167
168#define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when)) 168#define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when))
169 169
170#define TS_UPDATE_GPU_EST_START TIMESTAMP(210)
171#define TS_UPDATE_GPU_EST_END TIMESTAMP(211)
172
170#endif /* !_SYS_TRACE_H_ */ 173#endif /* !_SYS_TRACE_H_ */
diff --git a/litmus/gpu_affinity.c b/litmus/gpu_affinity.c
index e051fb7909a0..5c5d669421b3 100644
--- a/litmus/gpu_affinity.c
+++ b/litmus/gpu_affinity.c
@@ -7,6 +7,7 @@
7 7
8#include <litmus/sched_trace.h> 8#include <litmus/sched_trace.h>
9 9
10/* two second cap on crazy observations */
10#define OBSERVATION_CAP ((lt_t)(2e9)) 11#define OBSERVATION_CAP ((lt_t)(2e9))
11 12
12// reason for skew: high outliers are less 13// reason for skew: high outliers are less
@@ -14,7 +15,7 @@
14//#define HI_THRESHOLD 2 15//#define HI_THRESHOLD 2
15//#define LO_THRESHOLD 4 16//#define LO_THRESHOLD 4
16 17
17#define NUM_STDEV_NUM 1 18#define NUM_STDEV_NUM 3
18#define NUM_STDEV_DENOM 2 19#define NUM_STDEV_DENOM 2
19 20
20#define MIN(a, b) ((a < b) ? a : b) 21#define MIN(a, b) ((a < b) ? a : b)
@@ -60,9 +61,8 @@ static lt_t isqrt(lt_t n)
60 * (algo taken from wikipedia */ 61 * (algo taken from wikipedia */
61 lt_t res = 0; 62 lt_t res = 0;
62 lt_t bit = ((lt_t)1) << (sizeof(n)*8-2); 63 lt_t bit = ((lt_t)1) << (sizeof(n)*8-2);
63 while (bit > n) { 64 while (bit > n)
64 bit >>= 2; 65 bit >>= 2;
65 }
66 66
67 while (bit != 0) { 67 while (bit != 0) {
68 if (n >= res + bit) { 68 if (n >= res + bit) {
@@ -81,7 +81,6 @@ void update_gpu_estimate(struct task_struct *t, lt_t observed)
81{ 81{
82 avg_est_t *est; 82 avg_est_t *est;
83 83
84
85 BUG_ON(tsk_rt(t)->gpu_migration > MIG_LAST); 84 BUG_ON(tsk_rt(t)->gpu_migration > MIG_LAST);
86 85
87 est = &(tsk_rt(t)->gpu_migration_est[tsk_rt(t)->gpu_migration]); 86 est = &(tsk_rt(t)->gpu_migration_est[tsk_rt(t)->gpu_migration]);
@@ -122,18 +121,18 @@ void update_gpu_estimate(struct task_struct *t, lt_t observed)
122 } 121 }
123 } 122 }
124 123
125 if (unlikely(est->count < AVG_EST_WINDOW_SIZE)) { 124 if (unlikely(est->count < AVG_EST_WINDOW_SIZE))
126 ++est->count; 125 ++est->count;
127 } 126 else
128 else {
129 est->sum -= est->history[est->idx]; 127 est->sum -= est->history[est->idx];
130 }
131 128
129 TS_UPDATE_GPU_EST_START;
132 est->history[est->idx] = observed; 130 est->history[est->idx] = observed;
133 est->sum += observed; 131 est->sum += observed;
134 est->avg = est->sum/est->count; 132 est->avg = est->sum/est->count;
135 est->std = isqrt(varience(est->history, est->avg, est->count)); 133 est->std = isqrt(varience(est->history, est->avg, est->count));
136 est->idx = (est->idx + 1) % AVG_EST_WINDOW_SIZE; 134 est->idx = (est->idx + 1) % AVG_EST_WINDOW_SIZE;
135 TS_UPDATE_GPU_EST_END;
137 136
138 TRACE_TASK(t, "GPU est update after (dist = %d, obs = %llu): %llu\n", 137 TRACE_TASK(t, "GPU est update after (dist = %d, obs = %llu): %llu\n",
139 tsk_rt(t)->gpu_migration, 138 tsk_rt(t)->gpu_migration,
@@ -168,8 +167,4 @@ out:
168 return dist; 167 return dist;
169} 168}
170 169
171
172
173
174#endif 170#endif
175