aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index e2f85c7a7476..e4bf4477aee5 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8381,10 +8381,34 @@ static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft)
8381 return totalcpuusage; 8381 return totalcpuusage;
8382} 8382}
8383 8383
8384static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype,
8385 u64 reset)
8386{
8387 struct cpuacct *ca = cgroup_ca(cgrp);
8388 int err = 0;
8389 int i;
8390
8391 if (reset) {
8392 err = -EINVAL;
8393 goto out;
8394 }
8395
8396 for_each_possible_cpu(i) {
8397 u64 *cpuusage = percpu_ptr(ca->cpuusage, i);
8398
8399 spin_lock_irq(&cpu_rq(i)->lock);
8400 *cpuusage = 0;
8401 spin_unlock_irq(&cpu_rq(i)->lock);
8402 }
8403out:
8404 return err;
8405}
8406
8384static struct cftype files[] = { 8407static struct cftype files[] = {
8385 { 8408 {
8386 .name = "usage", 8409 .name = "usage",
8387 .read_uint = cpuusage_read, 8410 .read_uint = cpuusage_read,
8411 .write_uint = cpuusage_write,
8388 }, 8412 },
8389}; 8413};
8390 8414