aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 07:18:52 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2017-05-26 17:12:32 -0400
commit5ebb43a73f5be054eed1f7f7ee880bfd1ab73431 (patch)
treee9a342fa0b029f169b239c86c12570392fe319b2
parentdd4a184e7cbf78fd0880cc03456330c4980a4968 (diff)
Integrate LITMUS^RT with try_to_wake_up() path
-rw-r--r--kernel/sched/core.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1f8d205a8b7f..4fbcc40cb86d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -88,6 +88,7 @@
88#include "../workqueue_internal.h" 88#include "../workqueue_internal.h"
89#include "../smpboot.h" 89#include "../smpboot.h"
90 90
91#include <litmus/litmus.h>
91#include <litmus/trace.h> 92#include <litmus/trace.h>
92#include <litmus/sched_trace.h> 93#include <litmus/sched_trace.h>
93 94
@@ -1894,7 +1895,12 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags)
1894 struct pin_cookie cookie; 1895 struct pin_cookie cookie;
1895 1896
1896#if defined(CONFIG_SMP) 1897#if defined(CONFIG_SMP)
1897 if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { 1898 /*
1899 * LITMUS^RT: whether to send an IPI to the remote CPU is plugin
1900 * specific.
1901 */
1902 if (!is_realtime(p) &&
1903 sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) {
1898 sched_clock_cpu(cpu); /* sync clocks x-cpu */ 1904 sched_clock_cpu(cpu); /* sync clocks x-cpu */
1899 ttwu_queue_remote(p, cpu, wake_flags); 1905 ttwu_queue_remote(p, cpu, wake_flags);
1900 return; 1906 return;
@@ -2020,6 +2026,9 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
2020 unsigned long flags; 2026 unsigned long flags;
2021 int cpu, success = 0; 2027 int cpu, success = 0;
2022 2028
2029 if (is_realtime(p))
2030 TRACE_TASK(p, "try_to_wake_up() state:%d\n", p->state);
2031
2023 /* 2032 /*
2024 * If we are going to wake up a thread waiting for CONDITION we 2033 * If we are going to wake up a thread waiting for CONDITION we
2025 * need to ensure that CONDITION=1 done by the caller can not be 2034 * need to ensure that CONDITION=1 done by the caller can not be
@@ -2092,6 +2101,12 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
2092 */ 2101 */
2093 smp_cond_load_acquire(&p->on_cpu, !VAL); 2102 smp_cond_load_acquire(&p->on_cpu, !VAL);
2094 2103
2104 /* LITMUS^RT: once the task can be safely referenced by this
2105 * CPU, don't mess with Linux load balancing stuff.
2106 */
2107 if (is_realtime(p))
2108 goto litmus_out_activate;
2109
2095 p->sched_contributes_to_load = !!task_contributes_to_load(p); 2110 p->sched_contributes_to_load = !!task_contributes_to_load(p);
2096 p->state = TASK_WAKING; 2111 p->state = TASK_WAKING;
2097 2112
@@ -2100,12 +2115,16 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
2100 wake_flags |= WF_MIGRATED; 2115 wake_flags |= WF_MIGRATED;
2101 set_task_cpu(p, cpu); 2116 set_task_cpu(p, cpu);
2102 } 2117 }
2118
2119litmus_out_activate:
2103#endif /* CONFIG_SMP */ 2120#endif /* CONFIG_SMP */
2104 2121
2105 ttwu_queue(p, cpu, wake_flags); 2122 ttwu_queue(p, cpu, wake_flags);
2106stat: 2123stat:
2107 ttwu_stat(p, cpu, wake_flags); 2124 ttwu_stat(p, cpu, wake_flags);
2108out: 2125out:
2126 if (is_realtime(p))
2127 TRACE_TASK(p, "try_to_wake_up() done state:%d\n", p->state);
2109 raw_spin_unlock_irqrestore(&p->pi_lock, flags); 2128 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
2110 2129
2111 return success; 2130 return success;