Subject: [DEBUG PATCH] sched/fair: add profile for distribute_cfs_runtime() --- kernel/sched/fair.c | 10 ++++++++++ kernel/sched/sched.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d646451d617c1..a4e3780c076e3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5922,10 +5922,12 @@ static int tg_unthrottle_up(struct task_group *tg, void *data) cfs_rq->throttled_clock_self_time += delta; } + rq->unthrottled_cfs_rq++; /* Re-enqueue the tasks that have been throttled at this level. */ list_for_each_entry_safe(p, tmp, &cfs_rq->throttled_limbo_list, throttle_node) { list_del_init(&p->throttle_node); enqueue_task_fair(rq_of(cfs_rq), p, ENQUEUE_WAKEUP); + rq->unthrottled_task++; } /* Add cfs_rq with load or one or more already running entities to the list */ @@ -6192,6 +6194,9 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) struct rq_flags rf; struct rq *rq; LIST_HEAD(local_unthrottle); + unsigned int unthrottled_rqs = 0; + + trace_printk("cpu%d: begins\n", this_cpu); rcu_read_lock(); list_for_each_entry_rcu(cfs_rq, &cfs_b->throttled_cfs_rq, @@ -6228,6 +6233,7 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) if (cfs_rq->runtime_remaining > 0) { if (cpu_of(rq) != this_cpu) { unthrottle_cfs_rq_async(cfs_rq); + unthrottled_rqs++; } else { /* * We currently only expect to be unthrottling @@ -6250,12 +6256,16 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) struct rq *rq = rq_of(cfs_rq); rq_lock_irqsave(rq, &rf); + rq->unthrottled_cfs_rq = rq->unthrottled_task = 0; list_del_init(&cfs_rq->throttled_csd_list); if (cfs_rq_throttled(cfs_rq)) unthrottle_cfs_rq(cfs_rq); + trace_printk("cpu%d: finishes. unthrottled rqs=%u, unthrottled_cfs_rq=%d, unthrottled_task=%d\n", + raw_smp_processor_id(), unthrottled_rqs, + rq->unthrottled_cfs_rq, rq->unthrottled_task); rq_unlock_irqrestore(rq, &rf); } SCHED_WARN_ON(!list_empty(&local_unthrottle)); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 5c2af5a70163c..d004da2bc9071 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1309,6 +1309,8 @@ struct rq { #if defined(CONFIG_CFS_BANDWIDTH) && defined(CONFIG_SMP) call_single_data_t cfsb_csd; struct list_head cfsb_csd_list; + unsigned int unthrottled_cfs_rq; + unsigned int unthrottled_task; #endif }; -- 2.39.5