aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-08 12:22:35 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-08-07 03:46:53 -0400
commit0cc482ccaf2efdc8bdb674a67ebe7d36cd06ce39 (patch)
treea08c83494d0fe0e095d2acf5daca527ae78e0cd7
parent44bbdeefae36fd3926eeccce4e715d91d5ffe6a0 (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.
-rw-r--r--fs/select.c4
-rw-r--r--kernel/hrtimer.c3
-rw-r--r--kernel/mutex.c5
-rw-r--r--mm/page-writeback.c6
-rw-r--r--mm/page_alloc.c5
5 files changed, 17 insertions, 6 deletions
diff --git a/fs/select.c b/fs/select.c
index 8c1c96c27062..f53b3e421c26 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -28,6 +28,8 @@
28#include <linux/hrtimer.h> 28#include <linux/hrtimer.h>
29#include <linux/sched/rt.h> 29#include <linux/sched/rt.h>
30 30
31#include <litmus/litmus.h> /* for is_realtime() */
32
31#include <asm/uaccess.h> 33#include <asm/uaccess.h>
32 34
33 35
@@ -77,7 +79,7 @@ long select_estimate_accuracy(struct timespec *tv)
77 * Realtime tasks get a slack of 0 for obvious reasons. 79 * Realtime tasks get a slack of 0 for obvious reasons.
78 */ 80 */
79 81
80 if (rt_task(current)) 82 if (rt_task(current) || is_realtime(current))
81 return 0; 83 return 0;
82 84
83 ktime_get_ts(&now); 85 ktime_get_ts(&now);
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index c7f0c79b2cb5..60b6329ab222 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -49,6 +49,7 @@
49#include <linux/timer.h> 49#include <linux/timer.h>
50 50
51#include <litmus/debug_trace.h> 51#include <litmus/debug_trace.h>
52#include <litmus/litmus.h>
52 53
53#include <asm/uaccess.h> 54#include <asm/uaccess.h>
54 55
@@ -1701,7 +1702,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
1701 unsigned long slack; 1702 unsigned long slack;
1702 1703
1703 slack = current->timer_slack_ns; 1704 slack = current->timer_slack_ns;
1704 if (rt_task(current)) 1705 if (rt_task(current) || is_realtime(current))
1705 slack = 0; 1706 slack = 0;
1706 1707
1707 hrtimer_init_on_stack(&t.timer, clockid, mode); 1708 hrtimer_init_on_stack(&t.timer, clockid, mode);
diff --git a/kernel/mutex.c b/kernel/mutex.c
index ad53a664f113..a60d05e9498f 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -25,6 +25,8 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/debug_locks.h> 26#include <linux/debug_locks.h>
27 27
28#include <litmus/litmus.h>
29
28/* 30/*
29 * In the DEBUG case we are using the "NULL fastpath" for mutexes, 31 * In the DEBUG case we are using the "NULL fastpath" for mutexes,
30 * which forces all calls into the slowpath: 32 * which forces all calls into the slowpath:
@@ -325,7 +327,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
325 * we're an RT task that will live-lock because we won't let 327 * we're an RT task that will live-lock because we won't let
326 * the owner complete. 328 * the owner complete.
327 */ 329 */
328 if (!owner && (need_resched() || rt_task(task))) 330 if (!owner && (need_resched() ||
331 rt_task(task) || is_realtime(task)))
329 break; 332 break;
330 333
331 /* 334 /*
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 4514ad7415c3..03ce78694ed9 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -38,6 +38,8 @@
38#include <linux/sched/rt.h> 38#include <linux/sched/rt.h>
39#include <trace/events/writeback.h> 39#include <trace/events/writeback.h>
40 40
41#include <litmus/litmus.h> /* for is_realtime() */
42
41/* 43/*
42 * Sleep at most 200ms at a time in balance_dirty_pages(). 44 * Sleep at most 200ms at a time in balance_dirty_pages().
43 */ 45 */
@@ -279,7 +281,7 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty)
279 if (background >= dirty) 281 if (background >= dirty)
280 background = dirty / 2; 282 background = dirty / 2;
281 tsk = current; 283 tsk = current;
282 if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) { 284 if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk) || is_realtime(tsk)) {
283 background += background / 4; 285 background += background / 4;
284 dirty += dirty / 4; 286 dirty += dirty / 4;
285 } 287 }
@@ -333,7 +335,7 @@ static unsigned long zone_dirty_limit(struct zone *zone)
333 else 335 else
334 dirty = vm_dirty_ratio * zone_memory / 100; 336 dirty = vm_dirty_ratio * zone_memory / 100;
335 337
336 if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) 338 if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk) || is_realtime(tsk))
337 dirty += dirty / 4; 339 dirty += dirty / 4;
338 340
339 return dirty; 341 return dirty;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2ee0fd313f03..65299391e760 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -61,6 +61,8 @@
61#include <linux/hugetlb.h> 61#include <linux/hugetlb.h>
62#include <linux/sched/rt.h> 62#include <linux/sched/rt.h>
63 63
64#include <litmus/litmus.h> /* for is_realtime() */
65
64#include <asm/tlbflush.h> 66#include <asm/tlbflush.h>
65#include <asm/div64.h> 67#include <asm/div64.h>
66#include "internal.h" 68#include "internal.h"
@@ -2362,7 +2364,8 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
2362 * See also cpuset_zone_allowed() comment in kernel/cpuset.c. 2364 * See also cpuset_zone_allowed() comment in kernel/cpuset.c.
2363 */ 2365 */
2364 alloc_flags &= ~ALLOC_CPUSET; 2366 alloc_flags &= ~ALLOC_CPUSET;
2365 } else if (unlikely(rt_task(current)) && !in_interrupt()) 2367 } else if (unlikely(rt_task(current) || is_realtime(current))
2368 && !in_interrupt())
2366 alloc_flags |= ALLOC_HARDER; 2369 alloc_flags |= ALLOC_HARDER;
2367 2370
2368 if (likely(!(gfp_mask & __GFP_NOMEMALLOC))) { 2371 if (likely(!(gfp_mask & __GFP_NOMEMALLOC))) {