Hi, Folks
I'm trying to find the place where we could reduce the overhead
of cgroup, especially when there is only root_task_group
(thanks for Peter's suggestion).
I found that no place is using the load info of root_task_group
and root cfs_rq currently, could we do some thing like below
to reduce the overhead?
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2cebc81..67cf709 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1515,6 +1515,13 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update)
u64 now = cfs_rq_clock_task(cfs_rq) >> 20;
u64 decays;
+ /*
+ * do not work on root cfs_rq and task group, since no one need their
+ * load info.
+ */
+ if (cfs_rq->tg && cfs_rq->tg == &root_task_group)
+ return;
+
decays = now - cfs_rq->last_decay;
if (!decays && !force_update)
return;
There are other places we could save works if we stop calculate
the load info of root_task_group and root cfs_rq, like the update
work of blocked_load_avg, runnable_load_avg and tg_load_contrib.
Those info are used to calculate the load of cfs_rq, so we could
use that load when we calculate the parent cfs_rq's load sum, but
since root task group has no parent, those info should be useless.
Please let me know if you think this is wrong or you have better
idea on where we can reduce the overhead of cgroup.
Regards,
Michael Wang