Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3246083lfo; Sun, 22 May 2022 23:47:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpCC5n9dkaz9DY3iYvmfHS+ih+uxeAtOMK5eJQJBM/6ItBAT+TIJnsejppUsU2TuC2C8zq X-Received: by 2002:a17:90a:2809:b0:1df:35ca:2e6a with SMTP id e9-20020a17090a280900b001df35ca2e6amr24699405pjd.8.1653288429228; Sun, 22 May 2022 23:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653288429; cv=none; d=google.com; s=arc-20160816; b=DRxWYbKzo5JfpIFLX9blQMFUq9oRbznR1De9dl3yPfhFbeQPgbvXP0/B484zFOfT7C N0lsx0KlrUrRrw+aI+rmLMdFl1y0BAJbkoXSugysTHREvfvrgxPeVe6MHRhTQ9D2uHbw y4tZuw0yIraH3iI03aFZeXU6i2OiLro/Z9aUjGOeXZTpA1AORFKgjdiEZYq4EWcMtT9Q 07EzSsbtbhigBNj9pAC2sA/hVDT6huJyhrFKAOjxGu7chQc3abErPfj4zdmLdWgGYfwZ z42IJy6ZNN6H0Dj6ScXKJp8h3mx8pM+7XFUqZVdvHu+siWwLhtlD/8E7EraqxdwVCm5Q ip/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=T/ssDZXDd7/eY1p7k+SveQN0HGUJT39mZvyN4cT8bOs=; b=alwQLyKlbjo7WBCefMXWjLg94JOBetCRtyCp0ELU3msi5V2TR2eyxbHS09gWzBCOFE WQAO/y5vknuXPLVvMMYpGKJsi7kEeL1Jfob/WphqGH9YIOMdjKFHL3wUKTXnrp+4oXOZ OvO5tfawy88uVmM+fpwLTVsl+PVvztKqzgflFvSk6Vk6mBCZHV15pamvbVI2C71hJ9bQ bggFzY5L3MWkZJgWP9WcrXVAGmILnJp01Md7g7OO3Jzq5YaMmyVA3BKaMFp8SuzqYt5K HRMjwtdbZvCb7ZADu2sh3TZUXWBPXDyPrv/ItdLXPfzb5arokAjzZ67cs37T3c7hh7iq +E2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=MGDrvFhq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id fy14-20020a17090b020e00b001df7567a535si11475627pjb.179.2022.05.22.23.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:47:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=MGDrvFhq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1CCB50E19; Sun, 22 May 2022 23:17:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236081AbiETBcM (ORCPT + 99 others); Thu, 19 May 2022 21:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344481AbiETBcD (ORCPT ); Thu, 19 May 2022 21:32:03 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A589AE49 for ; Thu, 19 May 2022 18:32:02 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id nk9-20020a17090b194900b001df2fcdc165so10253367pjb.0 for ; Thu, 19 May 2022 18:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=T/ssDZXDd7/eY1p7k+SveQN0HGUJT39mZvyN4cT8bOs=; b=MGDrvFhqVt1UaJVCqugH5mSYTS/PN5XNnCCEu83rTagPjTOjW5FKf8YAGySUgotOpx R3egCdeVk0b6TNnmJhK+OHqnSKgSaPkZTwuf4N28K1EclMUtZW2ngCNJ9GKWb1M09NNM p6yPYpspcTAIYLpqF9zbExjFFPXIWKrLwE6abB+MJ8B1ktXVMPJtQwAWYC8TOV0MK+vM AnXXkajSjSnTpVMukTlLUDEeG1339zUOhmlTBh0CiSenS7giG2aExVZH20O7ZMbfWKJg UShqmt0jZQaBtxnWY5z9PYRHcmdXTH3SaTwt0NOP8PeoCITIujj0O0klbRScpYOUoCfw 6Dlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=T/ssDZXDd7/eY1p7k+SveQN0HGUJT39mZvyN4cT8bOs=; b=DdMW4pelUCm3a2T70lZ6+7O0U7l2ZfTv4TkHMLCYlaWnvBRnMx+BKH+pex+M4MH9aD fwyBsPjhQDsqXum8QSZl/c1mOWxkbVzlb+WDGLvZGqg9SuMSJUErhyAtV55gAmfCfm5P HmIzLVEhRU7nlsdmoeT2vYpdsKhWQ/6DSxXMTy+BgtQ44X4Atm83zHrBg9DTse5gE8AO r6Rm6iGJMr50Zpb4PRGjuVvpXOqb9LMmCh4RHkbBUFNBgI/s4Izz+O3GSxLmbjg43Vy6 3n598mUxwCgW3F5RpxWrBl/IyqnwxTWl+rVrrUGp6UBEyxTgHVgjxUeVRzebfqnU2yYi oasA== X-Gm-Message-State: AOAM531eu/lBv/q8p65yE4AtZSkCR884IJh6LiTveoEql+bvowYG/k7W cA6OfbDUGGkMfPL5TCDTuVXudSctQvA5rXX9nX9l5gHyR0yu7g== X-Received: by 2002:a17:90b:1d86:b0:1df:f670:dc51 with SMTP id pf6-20020a17090b1d8600b001dff670dc51mr1126375pjb.126.1653010321917; Thu, 19 May 2022 18:32:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shakeel Butt Date: Thu, 19 May 2022 18:31:50 -0700 Message-ID: Subject: Re: [PATCH 3/4] memcg: enable accounting for struct cgroup To: Vasily Averin Cc: Roman Gushchin , =?UTF-8?Q?Michal_Koutn=C3=BD?= , kernel@openvz.org, LKML , Vlastimil Babka , Michal Hocko , Cgroups Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 13, 2022 at 8:52 AM Vasily Averin 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 > --- > 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.