diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-12 15:17:26 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-12 15:17:26 -0400 |
commit | 4ffefb822b9d65d4efbedb60e3c9a0e76895cc5b (patch) | |
tree | 905444d931d01e59a8bd1b06a1e9e88b89a05377 /litmus/sync.c | |
parent | f4ffe0719dfc150ee182f308d31a226b034f206b (diff) |
Changed completion flag use to remove race condition in Cedf,Gedf.
Diffstat (limited to 'litmus/sync.c')
-rw-r--r-- | litmus/sync.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/litmus/sync.c b/litmus/sync.c index 3e79e0a12a5a..88a050e10ee7 100644 --- a/litmus/sync.c +++ b/litmus/sync.c | |||
@@ -50,12 +50,20 @@ static long do_wait_for_ts_release(void) | |||
50 | ret = wait_for_completion_interruptible(&wait.completion); | 50 | ret = wait_for_completion_interruptible(&wait.completion); |
51 | 51 | ||
52 | if (!ret) { | 52 | if (!ret) { |
53 | /* Setting this flag before releasing ensures that this CPU | ||
54 | * will be the next CPU to requeue the task on a ready or | ||
55 | * release queue. | ||
56 | */ | ||
57 | tsk_rt(current)->completed = 1; | ||
58 | mb(); | ||
59 | |||
53 | /* Completion succeeded, setup release. */ | 60 | /* Completion succeeded, setup release. */ |
54 | litmus->release_at(current, wait.ts_release_time | 61 | litmus->release_at(current, wait.ts_release_time |
55 | + current->rt_param.task_params.phase | 62 | + current->rt_param.task_params.phase |
56 | - current->rt_param.task_params.period); | 63 | - current->rt_param.task_params.period); |
57 | /* trigger advance to next job release at the programmed time */ | 64 | |
58 | ret = complete_job(); | 65 | schedule(); |
66 | ret = 0; | ||
59 | } else { | 67 | } else { |
60 | /* We were interrupted, must cleanup list. */ | 68 | /* We were interrupted, must cleanup list. */ |
61 | mutex_lock(&task_release_lock); | 69 | mutex_lock(&task_release_lock); |