sched/deadline: Add latency tracing for SCHED_DEADLINE tasks
It is very likely that systems that wants/needs to use the new SCHED_DEADLINE policy also want to have the scheduling latency of the -deadline tasks under control. For this reason a new version of the scheduling wakeup latency, called "wakeup_dl", is introduced. As a consequence of applying this patch there will be three wakeup latency tracer: * "wakeup", that deals with all tasks in the system; * "wakeup_rt", that deals with -rt and -deadline tasks only; * "wakeup_dl", that deals with -deadline tasks only. Signed-off-by: Dario Faggioli <raistlin@linux.it> Signed-off-by: Juri Lelli <juri.lelli@gmail.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1383831828-15501-9-git-send-email-juri.lelli@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
755378a471
commit
af6ace764d
@@ -1022,11 +1022,16 @@ trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr)
|
||||
#ifdef CONFIG_SCHED_TRACER
|
||||
static int trace_wakeup_test_thread(void *data)
|
||||
{
|
||||
/* Make this a RT thread, doesn't need to be too high */
|
||||
static const struct sched_param param = { .sched_priority = 5 };
|
||||
/* Make this a -deadline thread */
|
||||
static const struct sched_attr attr = {
|
||||
.sched_policy = SCHED_DEADLINE,
|
||||
.sched_runtime = 100000ULL,
|
||||
.sched_deadline = 10000000ULL,
|
||||
.sched_period = 10000000ULL
|
||||
};
|
||||
struct completion *x = data;
|
||||
|
||||
sched_setscheduler(current, SCHED_FIFO, ¶m);
|
||||
sched_setattr(current, &attr);
|
||||
|
||||
/* Make it know we have a new prio */
|
||||
complete(x);
|
||||
@@ -1040,8 +1045,8 @@ static int trace_wakeup_test_thread(void *data)
|
||||
/* we are awake, now wait to disappear */
|
||||
while (!kthread_should_stop()) {
|
||||
/*
|
||||
* This is an RT task, do short sleeps to let
|
||||
* others run.
|
||||
* This will likely be the system top priority
|
||||
* task, do short sleeps to let others run.
|
||||
*/
|
||||
msleep(100);
|
||||
}
|
||||
@@ -1054,21 +1059,21 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr)
|
||||
{
|
||||
unsigned long save_max = tracing_max_latency;
|
||||
struct task_struct *p;
|
||||
struct completion isrt;
|
||||
struct completion is_ready;
|
||||
unsigned long count;
|
||||
int ret;
|
||||
|
||||
init_completion(&isrt);
|
||||
init_completion(&is_ready);
|
||||
|
||||
/* create a high prio thread */
|
||||
p = kthread_run(trace_wakeup_test_thread, &isrt, "ftrace-test");
|
||||
/* create a -deadline thread */
|
||||
p = kthread_run(trace_wakeup_test_thread, &is_ready, "ftrace-test");
|
||||
if (IS_ERR(p)) {
|
||||
printk(KERN_CONT "Failed to create ftrace wakeup test thread ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* make sure the thread is running at an RT prio */
|
||||
wait_for_completion(&isrt);
|
||||
/* make sure the thread is running at -deadline policy */
|
||||
wait_for_completion(&is_ready);
|
||||
|
||||
/* start the tracing */
|
||||
ret = tracer_init(trace, tr);
|
||||
@@ -1082,19 +1087,19 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr)
|
||||
|
||||
while (p->on_rq) {
|
||||
/*
|
||||
* Sleep to make sure the RT thread is asleep too.
|
||||
* Sleep to make sure the -deadline thread is asleep too.
|
||||
* On virtual machines we can't rely on timings,
|
||||
* but we want to make sure this test still works.
|
||||
*/
|
||||
msleep(100);
|
||||
}
|
||||
|
||||
init_completion(&isrt);
|
||||
init_completion(&is_ready);
|
||||
|
||||
wake_up_process(p);
|
||||
|
||||
/* Wait for the task to wake up */
|
||||
wait_for_completion(&isrt);
|
||||
wait_for_completion(&is_ready);
|
||||
|
||||
/* stop the tracing. */
|
||||
tracing_stop();
|
||||
|
Reference in New Issue
Block a user