All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: vatsa-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Cc: dhaval-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	skumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
	menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	mingo-X9Un+BFzKDI@public.gmane.org,
	balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Subject: Re: [PATCH] sched: cpu accounting controller
Date: Thu, 29 Nov 2007 11:30:35 -0800	[thread overview]
Message-ID: <20071129113035.bbdf35db.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071129191737.GH5681-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

On Fri, 30 Nov 2007 00:47:37 +0530
Srivatsa Vaddagiri <vatsa-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> wrote:

> On Mon, Nov 12, 2007 at 11:57:03PM -0800, Paul Menage wrote:
> > > Regarding your concern about tracking cpu usage in different ways, it
> > > could be mitigated if we have cpuacct controller track usage as per
> > > information present in a task's sched entity structure
> > > (tsk->se.sum_exec_runtime) i.e call cpuacct_charge() from
> > > __update_curr() which would accumulate the execution time of the
> > > group in a SMP friendly manner (i.e dump it in a per-cpu per-group counter
> > > first and then aggregate to a global per-group counter).
> > 
> > That seems more reasonable than the current approach in cpu_acct.c
> 
> Paul,
> 	Sorry about the delay in getting back to this thread. I realized
> very recently that cpuacct controller has been removed from Linus's tree
> and have attempted to rework it as per our discussions.
> 
> Linus/Ingo,
> 	Commit cfb5285660aad4931b2ebbfa902ea48a37dfffa1 removed a usefull 
> feature for us, which provided a cpu accounting resource controller. This 
> feature would be usefull if someone wants to group tasks only for accounting 
> purpose and doesnt really want to exercise any control over their cpu 
> consumption.
> 
> The patch below reintroduces the feature. It is based on Paul Menage's
> original patch (Commit 62d0df64065e7c135d0002f069444fbdfc64768f), with
> these differences:
> 
> 	- Removed load average information. I felt it needs
> 	  more thought (esp to deal with SMP and virtualized platforms)
> 	  and can be added for 2.6.25 after more discussions.
> 	- Convert group cpu usage to be nanosecond accurate (as rest
> 	  of the cfs stats are) and invoke cpuacct_charge() from 
> 	  the respective scheduler classes
> 
> The patch also modifies the cpu controller not to provide the same
> accounting information.
>
> ...
> 
> 	- Make the accounting scalable on SMP systems (perhaps
>  	  for 2.6.25)

That sounds like a rather important todo.  How bad is it now?
 
> Index: current/include/linux/cpu_acct.h
> ===================================================================
> --- /dev/null
> +++ current/include/linux/cpu_acct.h
> @@ -0,0 +1,14 @@
> +
> +#ifndef _LINUX_CPU_ACCT_H
> +#define _LINUX_CPU_ACCT_H
> +
> +#include <linux/cgroup.h>
> +#include <asm/cputime.h>
> +
> +#ifdef CONFIG_CGROUP_CPUACCT
> +extern void cpuacct_charge(struct task_struct *, u64 cputime);

                                                  ^ no "p"

> +#else
> +static inline void cpuacct_charge(struct task_struct *p, u64 cputime) {}

                                                         ^ "p"
> +#endif

Personally I think "p" is a dopey name - we tend to standardise on "tsk"
for this.

> --- /dev/null
> +++ current/kernel/cpu_acct.c
> @@ -0,0 +1,103 @@
> +/*
> + * kernel/cpu_acct.c - CPU accounting cgroup subsystem
> + *
> + * Copyright (C) Google Inc, 2006
> + *
> + * Developed by Paul Menage (menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org) and Balbir Singh
> + * (balbir-xthvdsQ13ZrQT0dZR+AlfA@public.gmane.org)
> + *
> + */
> +
> +/*
> + * Example cgroup subsystem for reporting total CPU usage of tasks in a
> + * cgroup.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/cgroup.h>
> +#include <linux/fs.h>
> +#include <linux/rcupdate.h>
> +
> +#include <asm/div64.h>

I don't think this inclusion is needed?

> +struct cpuacct {
> +	struct cgroup_subsys_state css;
> +	spinlock_t lock;
> +	/* total time used by this class (in nanoseconds) */
> +	u64 time;
> +};
> +
> +struct cgroup_subsys cpuacct_subsys;

This can be made static.

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: vatsa@linux.vnet.ibm.com
Cc: menage@google.com, containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	mingo@elte.hu, balbir@linux.vnet.ibm.com,
	dhaval@linux.vnet.ibm.com, skumar@linux.vnet.ibm.com
Subject: Re: [PATCH] sched: cpu accounting controller
Date: Thu, 29 Nov 2007 11:30:35 -0800	[thread overview]
Message-ID: <20071129113035.bbdf35db.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071129191737.GH5681@linux.vnet.ibm.com>

On Fri, 30 Nov 2007 00:47:37 +0530
Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> wrote:

> On Mon, Nov 12, 2007 at 11:57:03PM -0800, Paul Menage wrote:
> > > Regarding your concern about tracking cpu usage in different ways, it
> > > could be mitigated if we have cpuacct controller track usage as per
> > > information present in a task's sched entity structure
> > > (tsk->se.sum_exec_runtime) i.e call cpuacct_charge() from
> > > __update_curr() which would accumulate the execution time of the
> > > group in a SMP friendly manner (i.e dump it in a per-cpu per-group counter
> > > first and then aggregate to a global per-group counter).
> > 
> > That seems more reasonable than the current approach in cpu_acct.c
> 
> Paul,
> 	Sorry about the delay in getting back to this thread. I realized
> very recently that cpuacct controller has been removed from Linus's tree
> and have attempted to rework it as per our discussions.
> 
> Linus/Ingo,
> 	Commit cfb5285660aad4931b2ebbfa902ea48a37dfffa1 removed a usefull 
> feature for us, which provided a cpu accounting resource controller. This 
> feature would be usefull if someone wants to group tasks only for accounting 
> purpose and doesnt really want to exercise any control over their cpu 
> consumption.
> 
> The patch below reintroduces the feature. It is based on Paul Menage's
> original patch (Commit 62d0df64065e7c135d0002f069444fbdfc64768f), with
> these differences:
> 
> 	- Removed load average information. I felt it needs
> 	  more thought (esp to deal with SMP and virtualized platforms)
> 	  and can be added for 2.6.25 after more discussions.
> 	- Convert group cpu usage to be nanosecond accurate (as rest
> 	  of the cfs stats are) and invoke cpuacct_charge() from 
> 	  the respective scheduler classes
> 
> The patch also modifies the cpu controller not to provide the same
> accounting information.
>
> ...
> 
> 	- Make the accounting scalable on SMP systems (perhaps
>  	  for 2.6.25)

That sounds like a rather important todo.  How bad is it now?
 
> Index: current/include/linux/cpu_acct.h
> ===================================================================
> --- /dev/null
> +++ current/include/linux/cpu_acct.h
> @@ -0,0 +1,14 @@
> +
> +#ifndef _LINUX_CPU_ACCT_H
> +#define _LINUX_CPU_ACCT_H
> +
> +#include <linux/cgroup.h>
> +#include <asm/cputime.h>
> +
> +#ifdef CONFIG_CGROUP_CPUACCT
> +extern void cpuacct_charge(struct task_struct *, u64 cputime);

                                                  ^ no "p"

> +#else
> +static inline void cpuacct_charge(struct task_struct *p, u64 cputime) {}

                                                         ^ "p"
> +#endif

Personally I think "p" is a dopey name - we tend to standardise on "tsk"
for this.

> --- /dev/null
> +++ current/kernel/cpu_acct.c
> @@ -0,0 +1,103 @@
> +/*
> + * kernel/cpu_acct.c - CPU accounting cgroup subsystem
> + *
> + * Copyright (C) Google Inc, 2006
> + *
> + * Developed by Paul Menage (menage@google.com) and Balbir Singh
> + * (balbir@in.ibm.com)
> + *
> + */
> +
> +/*
> + * Example cgroup subsystem for reporting total CPU usage of tasks in a
> + * cgroup.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/cgroup.h>
> +#include <linux/fs.h>
> +#include <linux/rcupdate.h>
> +
> +#include <asm/div64.h>

I don't think this inclusion is needed?

> +struct cpuacct {
> +	struct cgroup_subsys_state css;
> +	spinlock_t lock;
> +	/* total time used by this class (in nanoseconds) */
> +	u64 time;
> +};
> +
> +struct cgroup_subsys cpuacct_subsys;

This can be made static.



  parent reply	other threads:[~2007-11-29 19:30 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-13  5:25 Revert for cgroups CPU accounting subsystem patch Paul Menage
     [not found] ` <6599ad830711122125u576e85a6w428466a0ab46dbc6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-11-13  6:00   ` Srivatsa Vaddagiri
2007-11-13  6:00 ` Srivatsa Vaddagiri
2007-11-13  6:05   ` Paul Menage
2007-11-13  7:00     ` Balbir Singh
2007-11-13  7:10       ` Paul Menage
     [not found]         ` <6599ad830711122310nf7530cfs5ef1fea061b1252c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-11-13  7:29           ` Balbir Singh
2007-11-13  7:29         ` Balbir Singh
     [not found]           ` <47395277.1060006-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-13  7:34             ` Paul Menage
2007-11-13  7:59             ` Srivatsa Vaddagiri
2007-11-13  7:34           ` Paul Menage
2007-11-13  7:59           ` Srivatsa Vaddagiri
     [not found]             ` <20071113075946.GA14731-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-13  7:59               ` Paul Menage
2007-11-13  7:59             ` Paul Menage
     [not found]       ` <47394B84.8030008-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-13  7:10         ` Paul Menage
     [not found]     ` <6599ad830711122205g88aae4fua8dd76cf6e8ab84d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-11-13  7:00       ` Balbir Singh
2007-11-13  7:48       ` Srivatsa Vaddagiri
2007-11-13  7:48     ` Srivatsa Vaddagiri
     [not found]       ` <20071113074805.GA13499-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-13  7:57         ` Paul Menage
2007-11-13  7:57       ` Paul Menage
     [not found]         ` <6599ad830711122357i60482475o10c0e0935a9e00c0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-11-29 19:17           ` [PATCH] sched: cpu accounting controller Srivatsa Vaddagiri
2007-11-29 19:17         ` Srivatsa Vaddagiri
     [not found]           ` <20071129191737.GH5681-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-29 19:20             ` Ingo Molnar
2007-11-29 19:30             ` Andrew Morton [this message]
2007-11-29 19:30               ` Andrew Morton
2007-11-29 20:18               ` Srivatsa Vaddagiri
     [not found]                 ` <20071129201833.GA18023-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-30 12:42                   ` [PATCH] sched: cpu accounting controller (V2) Srivatsa Vaddagiri
2007-11-30 12:42                 ` Srivatsa Vaddagiri
2007-11-30 12:35                   ` Ingo Molnar
2007-11-30 13:09                     ` Srivatsa Vaddagiri
2007-11-30 13:34                       ` Ingo Molnar
     [not found]                       ` <20071130130903.GA30772-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-30 13:34                         ` Ingo Molnar
     [not found]                     ` <20071130123513.GA16690-X9Un+BFzKDI@public.gmane.org>
2007-11-30 13:09                       ` Srivatsa Vaddagiri
     [not found]                   ` <20071130124225.GM5681-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-30 12:35                     ` Ingo Molnar
2007-11-30 12:45                     ` Balbir Singh
2007-12-01  7:48                     ` Paul Menage
2007-11-30 12:45                   ` Balbir Singh
     [not found]                     ` <475005F7.7080702-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-30 13:53                       ` Ingo Molnar
2007-11-30 13:53                     ` Ingo Molnar
     [not found]                       ` <20071130135331.GA7145-X9Un+BFzKDI@public.gmane.org>
2007-11-30 14:00                         ` Balbir Singh
2007-11-30 14:00                       ` Balbir Singh
2007-11-30 18:45                       ` Balbir Singh
     [not found]                         ` <47505A53.8080906-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-30 19:46                           ` Ingo Molnar
2007-11-30 19:46                             ` Ingo Molnar
2007-12-01  7:48                   ` Paul Menage
     [not found]                     ` <6599ad830711302348n49900ca8jfa66fa71fde76a67-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-12-01  9:51                       ` Balbir Singh
2007-12-01  9:51                     ` Balbir Singh
     [not found]               ` <20071129113035.bbdf35db.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-11-29 20:18                 ` [PATCH] sched: cpu accounting controller Srivatsa Vaddagiri
2007-11-29 19:20           ` Ingo Molnar
     [not found]             ` <20071129192058.GC5238-X9Un+BFzKDI@public.gmane.org>
2007-11-29 19:39               ` Srivatsa Vaddagiri
2007-11-29 19:39                 ` Srivatsa Vaddagiri
     [not found]   ` <20071113060038.GC3359-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-13  6:05     ` Revert for cgroups CPU accounting subsystem patch Paul Menage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071129113035.bbdf35db.akpm@linux-foundation.org \
    --to=akpm-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
    --cc=balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dhaval-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=mingo-X9Un+BFzKDI@public.gmane.org \
    --cc=skumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=vatsa-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.