Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722565

Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting

From Waiman Long <longman@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting
Date 2017-08-29 17:40 +0200
Message-ID <ujQMp-4mN-9@gated-at.bofh.it> (permalink)
References <udl8B-5QR-19@gated-at.bofh.it> <udl8B-5QR-17@gated-at.bofh.it> <ujPQm-3Mg-21@gated-at.bofh.it> <ujQCK-4jx-1@gated-at.bofh.it>
Organization Red Hat

Show all headers | View raw


On 08/29/2017 11:24 AM, Tejun Heo wrote:
> Hello, Peter.
>
> On Tue, Aug 29, 2017 at 04:32:52PM +0200, Peter Zijlstra wrote:
>> So I mostly like. On accounting it only adds to the immediate cgroup (if
>> it has a parent, aka !root).
>>
>> On update it does a DFS of all sub-groups and propagates the deltas up
>> to the requested group.
> ...
>> What I don't get is why you need cgroup_cpu_stat_updated(). That is, I
>> see you use it to keep the keep the DFS 'stack' up-to-date, but what I
>> don't see is why you'd need that.
> That is to make reading stats O(number of descendants which have been
> active since last read) instad of O(number of all descendants) as
> there can be a lot of not-too-active cgroups in a system.  Stat
> reading can be frequent, so the combination can get really bad.  By
> keeping the updated list separate, increasing read frequency decreases
> the cost of each read.
>
> Also, please note that a system may end up with a lot of cgroups
> without the user intending to.  memcg drains removed cgroups lazily
> and the number of draining cgroups can reach very high numbers if the
> system isn't under memory pressure.  The plan is to add basic stats
> for other resources too and keeping it scalable w.r.t. idle cgroups
> allows using the same mechanism for all resources.

I think it will be good to put the rationale behind this function as a
comment in the code.

Cheers,
Longman

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting Peter Zijlstra <peterz@infradead.org> - 2017-08-29 16:40 +0200
  Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting Tejun Heo <tj@kernel.org> - 2017-08-29 17:30 +0200
    Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting Waiman Long <longman@redhat.com> - 2017-08-29 17:40 +0200
      Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting Tejun Heo <tj@kernel.org> - 2017-08-29 17:50 +0200
    Re: [PATCH 3/3] cgroup: Implement cgroup2 basic CPU usage accounting Peter Zijlstra <peterz@infradead.org> - 2017-08-29 18:00 +0200

csiph-web