All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Marian Marinov <mm-NV7Lj0SOnH0@public.gmane.org>
Cc: lxc-devel-cunTk1MwBs9qMoObBWhMNEqPaTDuhLve2LY78lusg7I@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Daniel P. Berrange"
	<berrange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Serge Hallyn
	<serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>,
	Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: RFC: cgroups aware proc
Date: Tue, 14 Jan 2014 11:05:41 +0100	[thread overview]
Message-ID: <20140114100541.GS7572@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <52D48BA6.2080701-NV7Lj0SOnH0@public.gmane.org>

On Tue, Jan 14, 2014 at 02:58:14AM +0200, Marian Marinov wrote:
> On 01/13/2014 07:12 PM, Peter Zijlstra wrote:
> >On Mon, Jan 13, 2014 at 06:23:50PM +0200, Marian Marinov wrote:
> >>Hello Peter,
> >>
> >>I need help with the scheduler.
> >>
> >>I'm currently trying to patch the /proc/loadavg to show the load that is
> >>only related to the processes from the current cgroup.
> >>
> >>I looked trough the code and I was hoping that tsk->sched_task_group->cfs_rq
> >>struct will give me the needed information, but unfortunately for me, it did
> >>not.
> >>
> >>Can you advise me, how to approach this problem?
> >
> >Yeah, don't :-) Really, loadavg is a stupid metric.
> 
> Yes... stupid, but unfortunately everyone is looking at it :(
> 
> >
> >>I'm totally new to the scheduler code.
> >
> >Luckily you won't actually have to touch much of it. Most of the actual
> >loadavg code lives in the first ~400 lines of kernel/sched/proc.c, read
> >and weep. Its one of the best documented bits around.
> 
> I looked trough it but I don't understand how to introduce the per cgroup calculation.
> 
> I looked trough the headers and found the following, which is already implemented.
> 
>   task->sched_task_group->load_avg
>   task->sched_task_group->cfs_rq->load_avg
>   task->sched_task_group->cfs_rq->load.weight
>   task->sched_task_group->cfs_rq->runnable_load_avg
> 
> Unfortunately there is almost no documentation for these elements of the cfs_rq and task_group structs.
> 
> It seams to me that part of the per task group loadavg code is already present.

No, those are actual load metrics and completely unrelated to loadavg.

Loadavg requires per-cgroup-per-cpu variants of nr_running and
nr_uninterruptible.

Those are the only metrics used in kernel/sched/proc.c for loadavg.

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Marian Marinov <mm@yuhu.biz>
Cc: lxc-devel@lists.linuxcontainers.org, cgroups@vger.kernel.org,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Serge Hallyn <serge.hallyn@ubuntu.com>,
	Li Zefan <lizefan@huawei.com>, Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: RFC: cgroups aware proc
Date: Tue, 14 Jan 2014 11:05:41 +0100	[thread overview]
Message-ID: <20140114100541.GS7572@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <52D48BA6.2080701@yuhu.biz>

On Tue, Jan 14, 2014 at 02:58:14AM +0200, Marian Marinov wrote:
> On 01/13/2014 07:12 PM, Peter Zijlstra wrote:
> >On Mon, Jan 13, 2014 at 06:23:50PM +0200, Marian Marinov wrote:
> >>Hello Peter,
> >>
> >>I need help with the scheduler.
> >>
> >>I'm currently trying to patch the /proc/loadavg to show the load that is
> >>only related to the processes from the current cgroup.
> >>
> >>I looked trough the code and I was hoping that tsk->sched_task_group->cfs_rq
> >>struct will give me the needed information, but unfortunately for me, it did
> >>not.
> >>
> >>Can you advise me, how to approach this problem?
> >
> >Yeah, don't :-) Really, loadavg is a stupid metric.
> 
> Yes... stupid, but unfortunately everyone is looking at it :(
> 
> >
> >>I'm totally new to the scheduler code.
> >
> >Luckily you won't actually have to touch much of it. Most of the actual
> >loadavg code lives in the first ~400 lines of kernel/sched/proc.c, read
> >and weep. Its one of the best documented bits around.
> 
> I looked trough it but I don't understand how to introduce the per cgroup calculation.
> 
> I looked trough the headers and found the following, which is already implemented.
> 
>   task->sched_task_group->load_avg
>   task->sched_task_group->cfs_rq->load_avg
>   task->sched_task_group->cfs_rq->load.weight
>   task->sched_task_group->cfs_rq->runnable_load_avg
> 
> Unfortunately there is almost no documentation for these elements of the cfs_rq and task_group structs.
> 
> It seams to me that part of the per task group loadavg code is already present.

No, those are actual load metrics and completely unrelated to loadavg.

Loadavg requires per-cgroup-per-cpu variants of nr_running and
nr_uninterruptible.

Those are the only metrics used in kernel/sched/proc.c for loadavg.

  parent reply	other threads:[~2014-01-14 10:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <529350DB.3010906@yuhu.biz>
     [not found] ` <20131125150940.GB7120@sergelap>
     [not found]   ` <20131125151232.GR6766@redhat.com>
     [not found]     ` <52937B0C.3070005@yuhu.biz>
     [not found]       ` <52937B0C.3070005-NV7Lj0SOnH0@public.gmane.org>
2014-01-04  4:28         ` RFC: cgroups aware proc Marian Marinov
     [not found]           ` <52C78E09.60904-NV7Lj0SOnH0@public.gmane.org>
2014-01-05  0:12             ` Marian Marinov
     [not found]               ` <52C8A36B.6030201-NV7Lj0SOnH0@public.gmane.org>
2014-01-07 11:16                 ` Li Zefan
2014-01-07 11:17                 ` Li Zefan
     [not found]                   ` <52CBE22F.1010106-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-01-07 17:42                     ` Marian Marinov
     [not found]                       ` <52CC3C80.8030603-NV7Lj0SOnH0@public.gmane.org>
2014-01-08 15:27                         ` Serge Hallyn
2014-01-10 16:29                           ` Marian Marinov
2014-01-13  3:26                         ` Li Zefan
     [not found]                           ` <52D41316.5080508@yuhu.biz>
2014-01-13 17:12                             ` Fwd: " Peter Zijlstra
     [not found]                               ` <20140113171238.GS31570-ndre7Fmf5hadTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2014-01-14  0:58                                 ` Marian Marinov
2014-01-14  0:58                                   ` Marian Marinov
     [not found]                                   ` <52D48BA6.2080701-NV7Lj0SOnH0@public.gmane.org>
2014-01-14 10:05                                     ` Peter Zijlstra [this message]
2014-01-14 10:05                                       ` Peter Zijlstra

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=20140114100541.GS7572@laptop.programming.kicks-ass.net \
    --to=peterz-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=berrange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=lxc-devel-cunTk1MwBs9qMoObBWhMNEqPaTDuhLve2LY78lusg7I@public.gmane.org \
    --cc=mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=mm-NV7Lj0SOnH0@public.gmane.org \
    --cc=serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@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.