Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp956985iob; Fri, 13 May 2022 17:40:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOUtQOaL9dle7nqfKN49F9BgxCn/LW/sDcXKwzMqfUDlXSe2PTWoiNxZ6POVA+Su0KvWEN X-Received: by 2002:a05:600c:1d9d:b0:394:7d22:9bdd with SMTP id p29-20020a05600c1d9d00b003947d229bddmr17074996wms.111.1652488833545; Fri, 13 May 2022 17:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652488833; cv=none; d=google.com; s=arc-20160816; b=Umm+z1WUtnmaLNoJQkMibs6DD95WKOAb4oGmWAuMmmDT19cP256yGsT89eIBKmb5qP qr0TPOZraejcLFhpFJRiRa80DairVgdBusFs7KG4nvIuQZDVtxKO+iFl9EKXsb5Adh+k XX5JyFVI7O3YKJffsOYFbq/vnXy4UhwBeLQdw7Wh6gp/Lqr4OYmFR8oUkfM0SFy6XFT7 D7aMoLe3ADWy1lJ0Rfm+htAOaEgRz4JDuAPh79xpERxJ9H9+wYYTOOi8fl30dW9sO/C/ 3D9VIFyM2mIn1H2xrVWsBY0iNbNZ9MRF5ujmUpvsGyu9dp8RzdiRxXmmyihiZgD03MqW KGxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=B97ovzBTCo6Rpt8pan1l5/t89Mv44hmEDRujwkHt9Ic=; b=cl3m4Xkv2LILB1/3MFElvhfvWX0kK3r+fvIXhhDJq2a00WSctUybHV3Pnzn8FbH+ly 0+H4FmIaL79HEdn6sEFe2eeuAIjf8XbXmKIZJ6nmds1dSU34OpU1MmWnTFH0SG7GmdCa +Gee6XkdeKhfYEptr/wMcQvqiUjChSf7PHeRC+YR1r0Vfa5UCc5L0oLfHccISdz8EWuT cnhouHQdI38UAf27ACAOUy5QBriw/3iYxReHyvp7/RYOICbr2OT4mrDqjOcSU/iQDC+J UaHITHjAC4mTst8bXWXsRLZgo4OHbJ6D7G54sSL7wrfpBp1F7CtjLLVL3P15itv1K7B4 hnSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=Gn8g+5fj; 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=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u9-20020adfdb89000000b0020c579317ffsi3362450wri.781.2022.05.13.17.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:40:33 -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=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=Gn8g+5fj; 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=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C3667307317; Fri, 13 May 2022 16:22:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382301AbiEMPwe (ORCPT + 99 others); Fri, 13 May 2022 11:52:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382286AbiEMPwa (ORCPT ); Fri, 13 May 2022 11:52:30 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37BE1F0183 for ; Fri, 13 May 2022 08:52:23 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id t25so10784700ljd.6 for ; Fri, 13 May 2022 08:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:cc :references:content-language:in-reply-to:content-transfer-encoding; bh=B97ovzBTCo6Rpt8pan1l5/t89Mv44hmEDRujwkHt9Ic=; b=Gn8g+5fjv7e1DNvpLJ5tu50Zc48R9MGuaEXQSp7RNvhogmOV11JQQefjUfc1WAIjlK dJ/Lin0vXk+AFC5NAEVYN2uyQ/gVoUsQbdGSNQXxKRCPgLwfFI/l9Bdy731b3hcb9sZ0 M9Y0mpjbO9Uy/K1xvNR9RdgPtgC2prB26Xi8anmhW3UIQ1yx1q2nGP5nymZuPcIO4zAl d9HNvFH9D6xBd+fZ9EhSkrrOJCdp0ME9jdlh24Az1mJ3jeZXcyBhCoUXZDDqEuirAx5s UJSJC4S+K2fYuUMqxdXQJbU8gdSPCbignrbxY+XB/Xjch9vQJ0hN6qZ0RIGgOcOB1QxS TuPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:cc:references:content-language:in-reply-to :content-transfer-encoding; bh=B97ovzBTCo6Rpt8pan1l5/t89Mv44hmEDRujwkHt9Ic=; b=sTJNVh4rjv6gRTvAd4Cdvg6t8/99bk6ZWvqUnhxp+mfbhGuiofYpD4Dj5wtOiL0CTr nTwOWHLvVhrHu+xNn84J+HPAJ3LUPA2nRoHLF1YzB47aCXEXvCI+BxcTnFWAy0lxmbP1 1hLYk0oX8N5ntoGSrzWZVFqNrhNLswLZSlE7MQgTLOcuAlKWtX4sE7kzOiqyk/0EtS9u 11FL9S47JusneJ9Q5uNKi+tG6ZkcAaR+mQuSz0vni7ezNIgCrbdbTD9fxQ3a/hT95z8Z QS+tPKo1ndW0UOQUu65fs5xiv/p/65RXJSoVaDulZjEFV99HBC0CRR7UJ2aZvjWuGaL0 vbgg== X-Gm-Message-State: AOAM531+TFPgHOfXLjKO96OcbKq1T1LQ2UGniGSRcZgGxak73YP/OUU7 YxVKMpbjCdeWTqXu6qNkBRECog== X-Received: by 2002:a2e:3217:0:b0:250:896d:f894 with SMTP id y23-20020a2e3217000000b00250896df894mr3436894ljy.283.1652457141899; Fri, 13 May 2022 08:52:21 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.177]) by smtp.gmail.com with ESMTPSA id j17-20020a056512345100b0047255d21152sm418647lfr.129.2022.05.13.08.52.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 May 2022 08:52:21 -0700 (PDT) Message-ID: <30f5b95a-db87-3924-6ad0-4c302c924ff0@openvz.org> Date: Fri, 13 May 2022 18:52:20 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 From: Vasily Averin Subject: [PATCH 4/4] memcg: enable accounting for allocations in alloc_fair_sched_group To: Roman Gushchin , Shakeel Butt , =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: kernel@openvz.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Michal Hocko , cgroups@vger.kernel.org References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Creating of each new cpu cgroup allocates two 512-bytes kernel objects per CPU. This is especially important for cgroups shared parent memory cgroup. In this scenario, on nodes with multiple processors, these allocations become one of the main memory consumers. Accounting for this memory helps to avoid misuse inside memcg-limited contianers. Signed-off-by: Vasily Averin --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a68482d66535..46e66acf7475 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11529,12 +11529,12 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) for_each_possible_cpu(i) { cfs_rq = kzalloc_node(sizeof(struct cfs_rq), - GFP_KERNEL, cpu_to_node(i)); + GFP_KERNEL_ACCOUNT, cpu_to_node(i)); if (!cfs_rq) goto err; se = kzalloc_node(sizeof(struct sched_entity_stats), - GFP_KERNEL, cpu_to_node(i)); + GFP_KERNEL_ACCOUNT, cpu_to_node(i)); if (!se) goto err_free_rq; -- 2.31.1