Skip to content

Commit

Permalink
revert "Task Control Groups: example CPU accounting subsystem"
Browse files Browse the repository at this point in the history
Revert 62d0df6.

This was originally intended as a simple initial example of how to create a
control groups subsystem; it wasn't intended for mainline, but I didn't make
this clear enough to Andrew.

The CFS cgroup subsystem now has better functionality for the per-cgroup usage
accounting (based directly on CFS stats) than the "usage" status file in this
patch, and the "load" status file is rather simplistic - although having a
per-cgroup load average report would be a useful feature, I don't believe this
patch actually provides it.  If it gets into the final 2.6.24 we'd probably
have to support this interface for ever.

Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
akpm00 authored and Linus Torvalds committed Nov 15, 2007
1 parent 45c682a commit cfb5285
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 225 deletions.
6 changes: 0 additions & 6 deletions include/linux/cgroup_subsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ SUBSYS(cpuset)

/* */

#ifdef CONFIG_CGROUP_CPUACCT
SUBSYS(cpuacct)
#endif

/* */

#ifdef CONFIG_CGROUP_DEBUG
SUBSYS(debug)
#endif
Expand Down
14 changes: 0 additions & 14 deletions include/linux/cpu_acct.h

This file was deleted.

7 changes: 0 additions & 7 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,6 @@ config CGROUP_NS
for instance virtual servers and checkpoint/restart
jobs.

config CGROUP_CPUACCT
bool "Simple CPU accounting cgroup subsystem"
depends on CGROUPS
help
Provides a simple Resource Controller for monitoring the
total CPU consumed by the tasks in a cgroup

config CPUSETS
bool "Cpuset support"
depends on SMP && CGROUPS
Expand Down
1 change: 0 additions & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_CGROUPS) += cgroup.o
obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o
obj-$(CONFIG_CPUSETS) += cpuset.o
obj-$(CONFIG_CGROUP_CPUACCT) += cpu_acct.o
obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o
obj-$(CONFIG_IKCONFIG) += configs.o
obj-$(CONFIG_STOP_MACHINE) += stop_machine.o
Expand Down
186 changes: 0 additions & 186 deletions kernel/cpu_acct.c

This file was deleted.

14 changes: 3 additions & 11 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include <linux/cpu.h>
#include <linux/cpuset.h>
#include <linux/percpu.h>
#include <linux/cpu_acct.h>
#include <linux/kthread.h>
#include <linux/seq_file.h>
#include <linux/sysctl.h>
Expand Down Expand Up @@ -3338,13 +3337,9 @@ void account_user_time(struct task_struct *p, cputime_t cputime)
{
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
cputime64_t tmp;
struct rq *rq = this_rq();

p->utime = cputime_add(p->utime, cputime);

if (p != rq->idle)
cpuacct_charge(p, cputime);

/* Add user time to cpustat. */
tmp = cputime_to_cputime64(cputime);
if (TASK_NICE(p) > 0)
Expand Down Expand Up @@ -3408,10 +3403,9 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
cpustat->irq = cputime64_add(cpustat->irq, tmp);
else if (softirq_count())
cpustat->softirq = cputime64_add(cpustat->softirq, tmp);
else if (p != rq->idle) {
else if (p != rq->idle)
cpustat->system = cputime64_add(cpustat->system, tmp);
cpuacct_charge(p, cputime);
} else if (atomic_read(&rq->nr_iowait) > 0)
else if (atomic_read(&rq->nr_iowait) > 0)
cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
else
cpustat->idle = cputime64_add(cpustat->idle, tmp);
Expand Down Expand Up @@ -3447,10 +3441,8 @@ void account_steal_time(struct task_struct *p, cputime_t steal)
cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
else
cpustat->idle = cputime64_add(cpustat->idle, tmp);
} else {
} else
cpustat->steal = cputime64_add(cpustat->steal, tmp);
cpuacct_charge(p, -tmp);
}
}

/*
Expand Down

0 comments on commit cfb5285

Please sign in to comment.