mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
sched: Fix latencytop and sleep profiling vs group scheduling
The latencytop and sleep accounting code assumes that any scheduler entity represents a task, this is not so. Cc: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
ed680c4ad4
commit
e414314cce
1 changed files with 19 additions and 13 deletions
|
@ -611,9 +611,13 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||||
static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SCHEDSTATS
|
#ifdef CONFIG_SCHEDSTATS
|
||||||
|
struct task_struct *tsk = NULL;
|
||||||
|
|
||||||
|
if (entity_is_task(se))
|
||||||
|
tsk = task_of(se);
|
||||||
|
|
||||||
if (se->sleep_start) {
|
if (se->sleep_start) {
|
||||||
u64 delta = rq_of(cfs_rq)->clock - se->sleep_start;
|
u64 delta = rq_of(cfs_rq)->clock - se->sleep_start;
|
||||||
struct task_struct *tsk = task_of(se);
|
|
||||||
|
|
||||||
if ((s64)delta < 0)
|
if ((s64)delta < 0)
|
||||||
delta = 0;
|
delta = 0;
|
||||||
|
@ -624,11 +628,11 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||||
se->sleep_start = 0;
|
se->sleep_start = 0;
|
||||||
se->sum_sleep_runtime += delta;
|
se->sum_sleep_runtime += delta;
|
||||||
|
|
||||||
account_scheduler_latency(tsk, delta >> 10, 1);
|
if (tsk)
|
||||||
|
account_scheduler_latency(tsk, delta >> 10, 1);
|
||||||
}
|
}
|
||||||
if (se->block_start) {
|
if (se->block_start) {
|
||||||
u64 delta = rq_of(cfs_rq)->clock - se->block_start;
|
u64 delta = rq_of(cfs_rq)->clock - se->block_start;
|
||||||
struct task_struct *tsk = task_of(se);
|
|
||||||
|
|
||||||
if ((s64)delta < 0)
|
if ((s64)delta < 0)
|
||||||
delta = 0;
|
delta = 0;
|
||||||
|
@ -639,17 +643,19 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||||
se->block_start = 0;
|
se->block_start = 0;
|
||||||
se->sum_sleep_runtime += delta;
|
se->sum_sleep_runtime += delta;
|
||||||
|
|
||||||
/*
|
if (tsk) {
|
||||||
* Blocking time is in units of nanosecs, so shift by 20 to
|
/*
|
||||||
* get a milliseconds-range estimation of the amount of
|
* Blocking time is in units of nanosecs, so shift by
|
||||||
* time that the task spent sleeping:
|
* 20 to get a milliseconds-range estimation of the
|
||||||
*/
|
* amount of time that the task spent sleeping:
|
||||||
if (unlikely(prof_on == SLEEP_PROFILING)) {
|
*/
|
||||||
|
if (unlikely(prof_on == SLEEP_PROFILING)) {
|
||||||
profile_hits(SLEEP_PROFILING, (void *)get_wchan(tsk),
|
profile_hits(SLEEP_PROFILING,
|
||||||
delta >> 20);
|
(void *)get_wchan(tsk),
|
||||||
|
delta >> 20);
|
||||||
|
}
|
||||||
|
account_scheduler_latency(tsk, delta >> 10, 0);
|
||||||
}
|
}
|
||||||
account_scheduler_latency(tsk, delta >> 10, 0);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue