[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALvZod5pFkm36r1nT2vmUX+Q1hy-MTKaGXOXpcT0Wra1oU=etw@mail.gmail.com>
Date: Thu, 19 May 2022 18:31:50 -0700
From: Shakeel Butt <shakeelb@...gle.com>
To: Vasily Averin <vvs@...nvz.org>
Cc: Roman Gushchin <roman.gushchin@...ux.dev>,
Michal Koutný <mkoutny@...e.com>,
kernel@...nvz.org, LKML <linux-kernel@...r.kernel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...e.com>,
Cgroups <cgroups@...r.kernel.org>
Subject: Re: [PATCH 3/4] memcg: enable accounting for struct cgroup
On Fri, May 13, 2022 at 8:52 AM Vasily Averin <vvs@...nvz.org> wrote:
>
> Creating each new cgroup allocates 4Kb for struct cgroup. This is the
> largest memory allocation in this scenario and is epecially important
> for small VMs with 1-2 CPUs.
>
> Accounting of this memory helps to avoid misuse inside memcg-limited
> containers.
>
> Signed-off-by: Vasily Averin <vvs@...nvz.org>
> ---
> kernel/cgroup/cgroup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index adb820e98f24..7595127c5b3a 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -5353,7 +5353,7 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
>
> /* allocate the cgroup and its ID, 0 is reserved for the root */
> cgrp = kzalloc(struct_size(cgrp, ancestor_ids, (level + 1)),
> - GFP_KERNEL);
> + GFP_KERNEL_ACCOUNT);
> if (!cgrp)
> return ERR_PTR(-ENOMEM);
>
Please include cgroup_rstat_cpu as well.
Powered by blists - more mailing lists