Skip to content

Commit

Permalink
Merge "sched/rt: print RT tasks when RT throttling is activated"
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux Build Service Account authored and Gerrit - the friendly Code Review server committed Jul 25, 2014
2 parents e153e5f + 3e43cdd commit e88deaa
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion kernel/sched/rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,42 @@ static inline int rt_se_prio(struct sched_rt_entity *rt_se)
return rt_task_of(rt_se)->prio;
}

static void dump_throttled_rt_tasks(struct rt_rq *rt_rq)
{
struct rt_prio_array *array = &rt_rq->active;
struct sched_rt_entity *rt_se;
char buf[500];
char *pos = buf;
char *end = buf + sizeof(buf);
int idx;

pos += snprintf(pos, sizeof(buf),
"sched: RT throttling activated for rt_rq %p (cpu %d)\n",
rt_rq, cpu_of(rq_of_rt_rq(rt_rq)));

if (bitmap_empty(array->bitmap, MAX_RT_PRIO))
goto out;

pos += snprintf(pos, end - pos, "potential CPU hogs:\n");
idx = sched_find_first_bit(array->bitmap);
while (idx < MAX_RT_PRIO) {
list_for_each_entry(rt_se, array->queue + idx, run_list) {
struct task_struct *p;

if (!rt_entity_is_task(rt_se))
continue;

p = rt_task_of(rt_se);
if (pos < end)
pos += snprintf(pos, end - pos, "\t%s (%d)\n",
p->comm, p->pid);
}
idx = find_next_bit(array->bitmap, MAX_RT_PRIO, idx + 1);
}
out:
printk_sched("%s", buf);
}

static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
{
u64 runtime = sched_rt_runtime(rt_rq);
Expand Down Expand Up @@ -852,7 +888,7 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)

if (!once) {
once = true;
printk_sched("sched: RT throttling activated\n");
dump_throttled_rt_tasks(rt_rq);
}
} else {
/*
Expand Down

0 comments on commit e88deaa

Please sign in to comment.