[RFC tg_shares_up improvements - v1 12/12] debug: export effective shares for analysis versus specified

pjt
2010-10-16T04:53:42Z

[-- Attachment #1: sched-tg-debug-add_issued_shares.patch --]
[-- Type: text/plain, Size: 922 bytes --]

---
kernel/sched.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Index: kernel/sched.c
===================================================================
--- kernel/sched.c.orig
+++ kernel/sched.c
@@ -8607,6 +8607,21 @@ static u64 cpu_shares_read_u64(struct cg

return (u64) tg->shares;
}
+
+static u64 cpu_issued_shares_read_u64(struct cgroup *cgrp, struct cftype *cft)
+{
+ struct task_group *tg = cgroup_tg(cgrp);
+ u64 result = 0;
+ int i;
+
+ if (!tg->se[0])
+ return 0;
+
+ for_each_online_cpu(i)
+ result += tg->se[i]->load.weight;
+
+ return result;
+}
#endif /* CONFIG_FAIR_GROUP_SCHED */

#ifdef CONFIG_RT_GROUP_SCHED
@@ -8640,6 +8655,10 @@ static struct cftype cpu_files[] = {
.read_u64 = cpu_shares_read_u64,
.write_u64 = cpu_shares_write_u64,
},
+ {
+ .name = "issued_shares",
+ .read_u64 = cpu_issued_shares_read_u64,
+ },
#endif
#ifdef CONFIG_RT_GROUP_SCHED
{

--