diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-08-09 07:18:50 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2017-05-26 17:12:30 -0400 |
| commit | 9cd62c8dc5bad42f2de65e9a50fed0fe2608a162 (patch) | |
| tree | fafa75f7f34d0f1533b64795377e6a82b37d5244 /kernel/locking | |
| parent | a286e5f00ef48ab8d9b189370441ce90d855b306 (diff) | |
Augment rt_task() with is_realtime()
Whenever the kernel checks for rt_task() to avoid delaying real-time
tasks, we want it to also not delay LITMUS^RT tasks. Hence, most
calls to rt_task() should be matched by an equivalent call to
is_realtime().
Notably, this affects the implementations of select() and nanosleep(),
which use timer_slack_ns when setting up timers for non-real-time
tasks.
Diffstat (limited to 'kernel/locking')
| -rw-r--r-- | kernel/locking/mutex.c | 4 | ||||
| -rw-r--r-- | kernel/locking/rwsem-xadd.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index a70b90db3909..cfb3552caa6e 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c | |||
| @@ -27,6 +27,8 @@ | |||
| 27 | #include <linux/debug_locks.h> | 27 | #include <linux/debug_locks.h> |
| 28 | #include <linux/osq_lock.h> | 28 | #include <linux/osq_lock.h> |
| 29 | 29 | ||
| 30 | #include <litmus/litmus.h> /* for is_realtime() */ | ||
| 31 | |||
| 30 | /* | 32 | /* |
| 31 | * In the DEBUG case we are using the "NULL fastpath" for mutexes, | 33 | * In the DEBUG case we are using the "NULL fastpath" for mutexes, |
| 32 | * which forces all calls into the slowpath: | 34 | * which forces all calls into the slowpath: |
| @@ -368,7 +370,7 @@ static bool mutex_optimistic_spin(struct mutex *lock, | |||
| 368 | * we're an RT task that will live-lock because we won't let | 370 | * we're an RT task that will live-lock because we won't let |
| 369 | * the owner complete. | 371 | * the owner complete. |
| 370 | */ | 372 | */ |
| 371 | if (!owner && (need_resched() || rt_task(task))) | 373 | if (!owner && (need_resched() || rt_task(task) || is_realtime(task))) |
| 372 | break; | 374 | break; |
| 373 | 375 | ||
| 374 | /* | 376 | /* |
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c index 2337b4bb2366..2badbb915c53 100644 --- a/kernel/locking/rwsem-xadd.c +++ b/kernel/locking/rwsem-xadd.c | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | 18 | ||
| 19 | #include "rwsem.h" | 19 | #include "rwsem.h" |
| 20 | 20 | ||
| 21 | #include <litmus/litmus.h> /* for is_realtime() */ | ||
| 22 | |||
| 21 | /* | 23 | /* |
| 22 | * Guide to the rw_semaphore's count field for common values. | 24 | * Guide to the rw_semaphore's count field for common values. |
| 23 | * (32-bit case illustrated, similar for 64-bit) | 25 | * (32-bit case illustrated, similar for 64-bit) |
| @@ -414,7 +416,7 @@ static bool rwsem_optimistic_spin(struct rw_semaphore *sem) | |||
| 414 | * we're an RT task that will live-lock because we won't let | 416 | * we're an RT task that will live-lock because we won't let |
| 415 | * the owner complete. | 417 | * the owner complete. |
| 416 | */ | 418 | */ |
| 417 | if (!sem->owner && (need_resched() || rt_task(current))) | 419 | if (!sem->owner && (need_resched() || rt_task(current) || is_realtime(current))) |
| 418 | break; | 420 | break; |
| 419 | 421 | ||
| 420 | /* | 422 | /* |
