All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@openvz.org>
To: "Tejun Heo" <tj@kernel.org>, "Michal Koutný" <mkoutny@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org, kernel@openvz.org,
	Shakeel Butt <shakeelb@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <songmuchun@bytedance.com>,
	Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH 0/3] enable memcg accounting for kernfs objects
Date: Tue, 16 Aug 2022 10:47:05 +0300	[thread overview]
Message-ID: <62188f37-f816-08e9-cdd5-8df23131746d@openvz.org> (raw)
In-Reply-To: <b816f58a-ce25-c079-c6b3-a3406df246f9@openvz.org>

On 8/11/22 06:19, Vasily Averin wrote:
> On 8/9/22 20:56, Tejun Heo wrote:
>> Hello,
>>
>> On Tue, Aug 09, 2022 at 07:49:34PM +0200, Michal Koutný wrote:
>>> On Tue, Aug 09, 2022 at 07:31:31AM -1000, Tejun Heo <tj@kernel.org> wrote:
>>>> I'm not quite sure whether following the usual "charge it to the allocating
>>>> task's cgroup" is the best way to go about it. I wonder whether it'd be
>>>> better to attach it to the new cgroup's nearest ancestor with memcg enabled.
>>>
>>> See also 
>>> https://lore.kernel.org/r/YnBLge4ZQNbbxufc@blackbook/
>>> and
>>> https://lore.kernel.org/r/20220511163439.GD24172@blackbody.suse.cz/
>>
>> Ah, thanks. Vasily, can you please include some summary of the discussions
>> and the rationales for the path taken in the commit message?
> 
> Dear Tejun,
> thank you for the feedback, I'll do it in next patch set iteration.
> 
> However, I noticed another problem in neighborhood and I planned to
> add new patches into current patch set. One of the new patches is quite simple,
> however second one is quite complex and requires some discussion.

Summing up a private discussion with Tejun, Michal and Roman:
I'm going to create few new patches:

1) adjust active memcg for objects allocated during creation of new cgroup
  This patch will take memcg from parent cgroup an use it for accounting
  all objects allocated during creation of new cgroup.
  For that it moves set_active_memcg() calls from mem_cgroup_css_alloc()
  to cgroup_mkdir() and creates missing infrastructure.
  This allows you to predict which memcg should be used for object accounting,
  and should simplify debugging of possible problems and corner cases.

2) memcg: enable kernfs accounting: nodes and iattr
  Already discussed and approved patches.
  These objects consumes significant part of memory in various scenarios,
  including new cgroup creation and new net device creation.

3) adjust active memcg for simple_xattr accounting
  sysfs and tmpfs are in-memory file system, 
  for extended attributes they uses simple_xattr infrastructure.
  The patch forces sys_set[f]xattr calls to account xattr object
  to predictable memcg: for kernfs memcg will be taken from kernfs node,
  for shmem -- from shmem_info.
  Like 1) case, this allows to understand which memcg should be used
  for object accounting and simplify debugging of possible troubles.

4) memcg: enable accounting for simple_xattr: names and values
  This patch enables accounting for objects described in previous patch

5) simple_xattrs: replace list to rb-tree
  This significantly reduces the search time for existing entries.

Additionally Roman Gushchin prepares patch
"`put`ting the kernfs_node reference earlier in the cgroup removal process"

Thank you,
	Vasily Averin

  parent reply	other threads:[~2022-08-16  9:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31 15:37 [PATCH 0/3] enable memcg accounting for kernfs objects Vasily Averin
2022-08-09 17:31 ` Tejun Heo
2022-08-09 17:49   ` Michal Koutný
2022-08-09 17:56     ` Tejun Heo
2022-08-11  3:19       ` Vasily Averin
2022-08-11  4:58         ` [RFC PATCH] kernfs: enable per-inode limits for all xattr types Vasily Averin
2022-08-12 10:20           ` Christian Brauner
2022-08-13  4:16             ` Vasily Averin
2022-08-16  7:47         ` Vasily Averin [this message]
2022-08-17  7:42           ` [RFC PATCH] memcg: adjust memcg for new cgroup allocations Vasily Averin
2022-08-17  9:17             ` Michal Koutný
2022-08-17 15:02               ` Vasily Averin
2022-08-17 16:41               ` Tejun Heo
2022-08-23 12:04                 ` Vasily Averin
2022-08-23 16:22                   ` Tejun Heo
2022-08-18  9:10           ` [RFC PATCH] memcg: adjust memcg used to charge for new simple_xattrs objects Vasily Averin
2022-08-18 12:27             ` Michal Koutný
2022-08-23  8:17               ` Vasily Averin
2022-08-18  9:12           ` [RFC PATCH] simple_xattr: switch from list to rb_tree Vasily Averin
2022-08-18 13:19             ` Christian Brauner
2022-08-23 10:42               ` Vasily Averin
2022-08-09 21:25   ` [PATCH 0/3] enable memcg accounting for kernfs objects Roman Gushchin

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=62188f37-f816-08e9-cdd5-8df23131746d@openvz.org \
    --to=vvs@openvz.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=mkoutny@suse.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.