diff options
| author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-10-09 06:49:49 -0400 |
|---|---|---|
| committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-10-09 06:49:49 -0400 |
| commit | 963259cdad73a9f7884177bde4bf949115dcf5ad (patch) | |
| tree | 246e6f93e1a31c0ccd4896e2a54af123cf4b02d9 | |
| parent | d2dd099221321f98a612027174d95e6bff2e0bc8 (diff) | |
adaptive: only send signal when requested.
| -rw-r--r-- | include/linux/litmus.h | 6 | ||||
| -rw-r--r-- | include/linux/rt_param.h | 3 | ||||
| -rw-r--r-- | kernel/litmus.c | 13 | ||||
| -rw-r--r-- | kernel/sched_adaptive.c | 13 | ||||
| -rw-r--r-- | kernel/sched_edf_hsb.c | 2 |
5 files changed, 32 insertions, 5 deletions
diff --git a/include/linux/litmus.h b/include/linux/litmus.h index 9a7047780d..dc39ecbf7e 100644 --- a/include/linux/litmus.h +++ b/include/linux/litmus.h | |||
| @@ -32,6 +32,12 @@ typedef enum { | |||
| 32 | } spolicy; | 32 | } spolicy; |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | typedef enum { | ||
| 36 | LITMUS_RESERVED_RANGE = 1024, | ||
| 37 | |||
| 38 | ENABLE_WEIGHT_CHANGE_SIGNAL | ||
| 39 | } sched_setup_cmd_t; | ||
| 40 | |||
| 35 | /* Runtime modes */ | 41 | /* Runtime modes */ |
| 36 | enum rt_mode_t { | 42 | enum rt_mode_t { |
| 37 | MODE_NON_RT = 0, | 43 | MODE_NON_RT = 0, |
diff --git a/include/linux/rt_param.h b/include/linux/rt_param.h index a3b3da770b..4835e1a4b9 100644 --- a/include/linux/rt_param.h +++ b/include/linux/rt_param.h | |||
| @@ -100,6 +100,9 @@ typedef struct task_rt_param { | |||
| 100 | * However, this limitation is not currently enforced. | 100 | * However, this limitation is not currently enforced. |
| 101 | */ | 101 | */ |
| 102 | unsigned int subject_to_srp:1; | 102 | unsigned int subject_to_srp:1; |
| 103 | |||
| 104 | /* Ready to receive scheduler signals? */ | ||
| 105 | unsigned int signal_ready:1; | ||
| 103 | 106 | ||
| 104 | /* scheduler signal list head */ | 107 | /* scheduler signal list head */ |
| 105 | unsigned int in_sig_list:1; | 108 | unsigned int in_sig_list:1; |
diff --git a/kernel/litmus.c b/kernel/litmus.c index 6da271f047..35160b7dd4 100644 --- a/kernel/litmus.c +++ b/kernel/litmus.c | |||
| @@ -497,7 +497,18 @@ asmlinkage spolicy sys_sched_getpolicy(void) | |||
| 497 | 497 | ||
| 498 | asmlinkage int sys_scheduler_setup(int cmd, void __user *parameter) | 498 | asmlinkage int sys_scheduler_setup(int cmd, void __user *parameter) |
| 499 | { | 499 | { |
| 500 | return curr_sched_plugin->scheduler_setup(cmd, parameter); | 500 | int ret = -EINVAL; |
| 501 | |||
| 502 | switch (cmd) { | ||
| 503 | case ENABLE_WEIGHT_CHANGE_SIGNAL: | ||
| 504 | current->rt_param.signal_ready = 1; | ||
| 505 | ret = 0; | ||
| 506 | break; | ||
| 507 | default: | ||
| 508 | ret = curr_sched_plugin->scheduler_setup(cmd, parameter); | ||
| 509 | }; | ||
| 510 | |||
| 511 | return ret; | ||
| 501 | } | 512 | } |
| 502 | 513 | ||
| 503 | /* only call with interrupts disabled! */ | 514 | /* only call with interrupts disabled! */ |
diff --git a/kernel/sched_adaptive.c b/kernel/sched_adaptive.c index 4a4ab430e0..f78b4d848d 100644 --- a/kernel/sched_adaptive.c +++ b/kernel/sched_adaptive.c | |||
| @@ -186,7 +186,8 @@ static void set_service_level(struct task_struct* t, unsigned int level) | |||
| 186 | t->rt_param.basic_params.exec_cost = _round(_mul(new->weight, | 186 | t->rt_param.basic_params.exec_cost = _round(_mul(new->weight, |
| 187 | FP(new->period))); | 187 | FP(new->period))); |
| 188 | 188 | ||
| 189 | scheduler_signal(t, SIGUSR1); | 189 | if (t->rt_param.signal_ready) |
| 190 | scheduler_signal(t, SIGUSR1); | ||
| 190 | 191 | ||
| 191 | sched_trace_service_level_change(t); | 192 | sched_trace_service_level_change(t); |
| 192 | TRACE_TASK(t, "service level %u activated\n", level); | 193 | TRACE_TASK(t, "service level %u activated\n", level); |
| @@ -195,9 +196,10 @@ static void set_service_level(struct task_struct* t, unsigned int level) | |||
| 195 | /* call this _before_ updating deadline and release of t */ | 196 | /* call this _before_ updating deadline and release of t */ |
| 196 | static void update_weight_estimate(struct task_struct* t) | 197 | static void update_weight_estimate(struct task_struct* t) |
| 197 | { | 198 | { |
| 198 | fp_t nw; | 199 | fp_t nw, ow; |
| 199 | jiffie_t sl_period, exec_time; | 200 | jiffie_t sl_period, exec_time; |
| 200 | 201 | ||
| 202 | ow = get_est_weight(t); | ||
| 201 | nw = t->rt_param.opt_nw; | 203 | nw = t->rt_param.opt_nw; |
| 202 | exec_time = t->rt_param.times.exec_time; | 204 | exec_time = t->rt_param.times.exec_time; |
| 203 | sl_period = get_sl(t, get_opt_sl(t)).period; | 205 | sl_period = get_sl(t, get_opt_sl(t)).period; |
| @@ -205,6 +207,7 @@ static void update_weight_estimate(struct task_struct* t) | |||
| 205 | t->rt_param.predictor_state.estimate = | 207 | t->rt_param.predictor_state.estimate = |
| 206 | _div( _max(_mul(nw, FP(sl_period)), FP(exec_time)), | 208 | _div( _max(_mul(nw, FP(sl_period)), FP(exec_time)), |
| 207 | FP(get_deadline(t) - get_last_release(t))); | 209 | FP(get_deadline(t) - get_last_release(t))); |
| 210 | TRACE_TASK(t, " update_weight_estimate: " _FP_ " => " _FP_ "\n", ow, get_est_weight(t)); | ||
| 208 | } | 211 | } |
| 209 | 212 | ||
| 210 | 213 | ||
| @@ -789,6 +792,10 @@ static noinline void job_completion(struct task_struct *t) | |||
| 789 | old_estimate = get_est_weight(t); | 792 | old_estimate = get_est_weight(t); |
| 790 | update_estimate(&t->rt_param.predictor_state, actual_weight, | 793 | update_estimate(&t->rt_param.predictor_state, actual_weight, |
| 791 | fc_a, fc_b); | 794 | fc_a, fc_b); |
| 795 | |||
| 796 | TRACE_TASK(t, " weight estimation: error=" _FP_ " weight=" _FP_ " => " _FP_ "\n", | ||
| 797 | _sub(get_est_weight(t), old_estimate), | ||
| 798 | old_estimate, get_est_weight(t)); | ||
| 792 | if (_gt(_div(_abs(_sub(get_est_weight(t), old_estimate)), | 799 | if (_gt(_div(_abs(_sub(get_est_weight(t), old_estimate)), |
| 793 | get_est_weight(t)), | 800 | get_est_weight(t)), |
| 794 | task_error_threshold)) { | 801 | task_error_threshold)) { |
diff --git a/kernel/sched_edf_hsb.c b/kernel/sched_edf_hsb.c index 075d61c024..c2a4c6c679 100644 --- a/kernel/sched_edf_hsb.c +++ b/kernel/sched_edf_hsb.c | |||
| @@ -1626,7 +1626,7 @@ static int hsb_mode_change(int new_mode) | |||
| 1626 | } | 1626 | } |
| 1627 | 1627 | ||
| 1628 | 1628 | ||
| 1629 | typedef enum { | 1629 | typedef enum { |
| 1630 | EDF_HSB_SET_HRT, | 1630 | EDF_HSB_SET_HRT, |
| 1631 | EDF_HSB_GET_HRT, | 1631 | EDF_HSB_GET_HRT, |
| 1632 | EDF_HSB_CREATE_BE | 1632 | EDF_HSB_CREATE_BE |
