diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-03-08 07:07:58 -0500 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-03-08 09:26:51 -0500 |
commit | 8db6123318df7021c858fb6b19675e1a04b934da (patch) | |
tree | acf5105873817bf1b511e4cf6c1de5a41c00a070 /litmus/jobs.c | |
parent | b4a0eda68638100b06b4cfc875775568208cd15d (diff) |
Don't preempt before time check in sleep_until_next_release()
Avoid preempting jobs that are about to go to sleep soon anyway.
Diffstat (limited to 'litmus/jobs.c')
-rw-r--r-- | litmus/jobs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/litmus/jobs.c b/litmus/jobs.c index 80649d989499..6199423086f8 100644 --- a/litmus/jobs.c +++ b/litmus/jobs.c | |||
@@ -90,12 +90,15 @@ long complete_job(void) | |||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | 92 | ||
93 | static long sleep_until_next_release(void); | ||
93 | 94 | ||
94 | /* alternative job completion implementation that suspends the task */ | 95 | /* alternative job completion implementation that suspends the task */ |
95 | long complete_job_oneshot(void) | 96 | long complete_job_oneshot(void) |
96 | { | 97 | { |
97 | struct task_struct *t = current; | 98 | struct task_struct *t = current; |
98 | 99 | ||
100 | preempt_disable(); | ||
101 | |||
99 | TRACE_CUR("job completes at %llu (deadline: %llu)\n", litmus_clock(), | 102 | TRACE_CUR("job completes at %llu (deadline: %llu)\n", litmus_clock(), |
100 | get_deadline(t)); | 103 | get_deadline(t)); |
101 | 104 | ||
@@ -106,13 +109,14 @@ long complete_job_oneshot(void) | |||
106 | return sleep_until_next_release(); | 109 | return sleep_until_next_release(); |
107 | } | 110 | } |
108 | 111 | ||
109 | long sleep_until_next_release(void) | 112 | /* assumes caller has disabled preemptions; |
113 | * re-enables preemptions before returning */ | ||
114 | static long sleep_until_next_release(void) | ||
110 | { | 115 | { |
111 | struct task_struct *t = current; | 116 | struct task_struct *t = current; |
112 | ktime_t next_release; | 117 | ktime_t next_release; |
113 | long err; | 118 | long err; |
114 | 119 | ||
115 | preempt_disable(); | ||
116 | next_release = ns_to_ktime(get_release(t)); | 120 | next_release = ns_to_ktime(get_release(t)); |
117 | 121 | ||
118 | TRACE_CUR("next_release=%llu\n", get_release(t)); | 122 | TRACE_CUR("next_release=%llu\n", get_release(t)); |