Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp157323iog; Sun, 12 Jun 2022 22:39:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw8BIu9XFnebfahhV0d/S48rDZ7db3hJ3MSycIkNz312bdqEWN1cAi++U0RVOL5vLNQIoh X-Received: by 2002:a17:90a:c981:b0:1e6:75f0:d4f1 with SMTP id w1-20020a17090ac98100b001e675f0d4f1mr13959282pjt.62.1655098779483; Sun, 12 Jun 2022 22:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655098779; cv=none; d=google.com; s=arc-20160816; b=Mu+2/6UNLW9sw1F+o5ss5kvpkhn4MCnXxdnEy5oRziBUbh41Fgxb8AWpuO1qz6cTj2 PMU2pqkL8ZaYYhdFPxLEEeEvp7XkqY65/3VTAjkK2wp53RX+a6OtK5yNSKqL//Iow7B3 DriLTxMGPppC1d9T6gywbD604kQ1UGj9oi3a0llrCOQMU1AZmg2QLv7mGc9fDttYamv3 BRyR6i7U/VjT/V7NYMDeT+wUazUiLE+xEIRaDqJvjZmag7i1Q3drnGVKTjQ7NsI3rIM0 63aC+zQQU20trT2Y76yTsdsCqPYpEXGOcDxuD2LlCSxnpx0eelndXLKIJ6VK6/ONfSo/ 7xPQ== 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=hqvRcJBRW/zXn9o8PLaPnPcK1byd11F8xwtbZSlj240=; b=i6i2SLy0iVwCSVcfFnuLgoV+lUrDARpArfbAsoHlM7SfJHjv3SyQfMQERD4J0EzkIW USs+kiwDlwmd3S3Xb36aN62wAQ5SJxSoMAWC1mgBf1jXbqtV8jlXMbq1Nv/uWMu2BMRD GDMmk0tb6Ow96rlXnEgsGX0knIHghu8wVFCZZ8JRxCcQ67f9QIKNOzBqdxOgHxrfo0JR 7wSxAnojWXY/h2OMRy8xwIvsELoe6mKajHBG26ESUvgvbAp+q3GDgiwjmdJuc2YxJW9h Co54vzK5ySb/iRQQVAD+F2aiv9L6wbrZMw6L85XYiR2pFsiJ0CNRrkUKQWE3kFNu+yh7 QGJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=58aW1GKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p21-20020a637415000000b003fd3a3df8bcsi8099477pgc.257.2022.06.12.22.39.26; Sun, 12 Jun 2022 22:39:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=58aW1GKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235158AbiFMFgq (ORCPT + 99 others); Mon, 13 Jun 2022 01:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234418AbiFMFgR (ORCPT ); Mon, 13 Jun 2022 01:36:17 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92A0712ABC for ; Sun, 12 Jun 2022 22:35:44 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id w20so7081867lfa.11 for ; Sun, 12 Jun 2022 22:35:44 -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=hqvRcJBRW/zXn9o8PLaPnPcK1byd11F8xwtbZSlj240=; b=58aW1GKW2Xnc6hX7c4ajeoo5cdVM2VXNCWYj3+RmWPIsMMcEya9nceDLXfxdDuL1RJ vFqjZjdUplMMnXO+GoNqLVSBeyv2codJ/Cdo/0P+m25U99sRmLSf87r3bRpz2KtogSHX nDg2iKGP1amPG4uJ/PV6KCiE/RHnOr64u2KfbnAupwelgVto6u2iX/YRnr6ea52wfDQH egQipz1wqYLmRlmNtCWxWVXO8L3KKQV9Wzlt3vZADHi8YHEB9nJ8HJIkn9dp8H0u3tl4 qFMxNsnU970ET5KhuiG5uGtXVrTkrI5+kltSmMicveonR3WCCFzn2uyzFuOg4dK17cO6 zlRA== 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=hqvRcJBRW/zXn9o8PLaPnPcK1byd11F8xwtbZSlj240=; b=QqU3PTFGCmhuOEeAE6RPUqOzHl1/XDo1KFqbPeJp6CD+k83yV/7/517L+2r3nmLaw+ juryJNNniMYkwUAapRgO0aC7RhlaRZX6fbj7iOEEs/ofZ4iJIx+8xcjXHiptpzYPBYyH IcKLWcU0kBv4x+Q/+nFEwSAbYJyaAp7qWPrMm4c2rf8VdEM+3BWMI5r5Ef2Ch7U4lEJg 25ommTI6+/k4gIXm3t43tOh4HiOXwjI+zTdahZ1FjlAodZ7eW7/xZPJ8t6fi986pMSYp HurDeCUn8bc2cQsxeW/bxpMee2tKpFV+34KX+0WwSDr2ocblexT6RiLFjU6hhC9FgqAy XS4g== X-Gm-Message-State: AOAM533ZuLqy6NJUZDoWosQQ4uVc53eWYUBnySxX8wTMHcRZgYM5yk0T GZ3i0Mdo5146Ux4iQYbcYwQYYw== X-Received: by 2002:a05:6512:3b07:b0:479:1535:b6e9 with SMTP id f7-20020a0565123b0700b004791535b6e9mr33502212lfv.494.1655098542761; Sun, 12 Jun 2022 22:35:42 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id w26-20020a05651204da00b0047863382e3dsm844618lfq.215.2022.06.12.22.35.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jun 2022 22:35:42 -0700 (PDT) Message-ID: <813662e2-bb99-2339-04f2-48cfa0d385db@openvz.org> Date: Mon, 13 Jun 2022 08:35:41 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 From: Vasily Averin Subject: [PATCH mm v4 8/9] memcg: enable accounting for allocations in alloc_fair_sched_group To: Andrew Morton Cc: kernel@openvz.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Roman Gushchin , =?UTF-8?Q?Michal_Koutn=c3=bd?= , Vlastimil Babka , Michal Hocko , Muchun Song , cgroups@vger.kernel.org References: <3e1d6eab-57c7-ba3d-67e1-c45aa0dfa2ab@openvz.org> Content-Language: en-US In-Reply-To: <3e1d6eab-57c7-ba3d-67e1-c45aa0dfa2ab@openvz.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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. Memory allocated during new cpu cgroup creation: common part: ~11Kb + 318 bytes percpu cpu cgroup: ~2.5Kb + 1036 bytes percpu Accounting for this memory helps to avoid misuse inside memcg-limited contianers. Signed-off-by: Vasily Averin Reviewed-by: Roman Gushchin Reviewed-by: Michal Koutný Acked-by: Shakeel Butt Reviewed-by: Muchun Song --- 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 e8202b5cd3d5..71161be1e783 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11503,12 +11503,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.36.1