aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-26 12:45:30 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2014-10-21 10:00:01 -0400
commit93919aeeb7b30971603a3d67b3d12091a45e9fbf (patch)
treebc9e44f2e5f5ffd157f23db1bb25c38aef9800a2 /kernel/sched
parent530f3c252277104613501e10cbfa63c09e4ca9c0 (diff)
Add SCHED, SCHED2, TICK, and CXS overhead tracepoints
This patch integrates the overhead tracepoints into the Linux scheduler that are compatible with plain vanilla Linux (i.e., not specific to LITMUS^RT plugins). This can be used to measure the overheads of an otherwise unmodified kernel.
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7eefaabc65a2..3a471d661e7a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -86,6 +86,8 @@
86#include "../workqueue_internal.h" 86#include "../workqueue_internal.h"
87#include "../smpboot.h" 87#include "../smpboot.h"
88 88
89#include <litmus/trace.h>
90
89#define CREATE_TRACE_POINTS 91#define CREATE_TRACE_POINTS
90#include <trace/events/sched.h> 92#include <trace/events/sched.h>
91 93
@@ -2748,6 +2750,8 @@ void scheduler_tick(void)
2748 2750
2749 sched_clock_tick(); 2751 sched_clock_tick();
2750 2752
2753 TS_TICK_START(current);
2754
2751 raw_spin_lock(&rq->lock); 2755 raw_spin_lock(&rq->lock);
2752 update_rq_clock(rq); 2756 update_rq_clock(rq);
2753 update_cpu_load_active(rq); 2757 update_cpu_load_active(rq);
@@ -2761,6 +2765,8 @@ void scheduler_tick(void)
2761 trigger_load_balance(rq, cpu); 2765 trigger_load_balance(rq, cpu);
2762#endif 2766#endif
2763 rq_last_tick_reset(rq); 2767 rq_last_tick_reset(rq);
2768
2769 TS_TICK_END(current);
2764} 2770}
2765 2771
2766#ifdef CONFIG_NO_HZ_FULL 2772#ifdef CONFIG_NO_HZ_FULL
@@ -2972,6 +2978,8 @@ need_resched:
2972 rcu_note_context_switch(cpu); 2978 rcu_note_context_switch(cpu);
2973 prev = rq->curr; 2979 prev = rq->curr;
2974 2980
2981 TS_SCHED_START;
2982
2975 schedule_debug(prev); 2983 schedule_debug(prev);
2976 2984
2977 if (sched_feat(HRTICK)) 2985 if (sched_feat(HRTICK))
@@ -3024,7 +3032,10 @@ need_resched:
3024 rq->curr = next; 3032 rq->curr = next;
3025 ++*switch_count; 3033 ++*switch_count;
3026 3034
3035 TS_SCHED_END(next);
3036 TS_CXS_START(next);
3027 context_switch(rq, prev, next); /* unlocks the rq */ 3037 context_switch(rq, prev, next); /* unlocks the rq */
3038 TS_CXS_END(current);
3028 /* 3039 /*
3029 * The context switch have flipped the stack from under us 3040 * The context switch have flipped the stack from under us
3030 * and restored the local variables which were saved when 3041 * and restored the local variables which were saved when
@@ -3033,12 +3044,19 @@ need_resched:
3033 */ 3044 */
3034 cpu = smp_processor_id(); 3045 cpu = smp_processor_id();
3035 rq = cpu_rq(cpu); 3046 rq = cpu_rq(cpu);
3036 } else 3047 } else {
3048 TS_SCHED_END(prev);
3037 raw_spin_unlock_irq(&rq->lock); 3049 raw_spin_unlock_irq(&rq->lock);
3050 }
3051
3052 TS_SCHED2_START(prev);
3038 3053
3039 post_schedule(rq); 3054 post_schedule(rq);
3040 3055
3041 sched_preempt_enable_no_resched(); 3056 sched_preempt_enable_no_resched();
3057
3058 TS_SCHED2_END(prev);
3059
3042 if (need_resched()) 3060 if (need_resched())
3043 goto need_resched; 3061 goto need_resched;
3044} 3062}