Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1656272ioo; Sun, 22 May 2022 23:14:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRQHScBGFWdmK1/DI7ztQ3UgS8yFl88/DtYGjx1fpWZm1sThT0qvkPkgTuAUVXYcQjlCu2 X-Received: by 2002:a17:90b:1d92:b0:1df:de65:8db7 with SMTP id pf18-20020a17090b1d9200b001dfde658db7mr21937866pjb.107.1653286480295; Sun, 22 May 2022 23:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653286480; cv=none; d=google.com; s=arc-20160816; b=gRkRwBR2Rq3bOmcDswrfV79elYT5Xfu21TCpLho6vDn7QZTH0rGMnu7zKJCVvHYDfJ +5P9UEBcsNWTJopEB9OsKJnSa+u5G4v8pm9j+zUCC/z/GD77ec/qlzgasdPGDQbl0G6a 5/l0PBjX9hEbbW/BzAmmvWJEu8eQyblaYVfm4JrhMTVhtm+ma75Vr2c1/P79g3KayuJV HVucmycaIE56NbLBa8G+SLNcyhjFbPsHeAVXH+h0xL20Ozo1sR1M49ez5VwX/qfACcKo 8HRvbOCRqct++UAYNIVxLLZQ+EvEUTPd8NFfYFknMVhXZfTj2mVQK5yiNdsXV3mt9L23 Ds8Q== 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=qcH7iik2GW8EIkmCTFLKGtsxL3Zpurysxl71BOJq3d0=; b=T3L7klXQKc0x4H95f2OrV/n8uwPhrfNKn4eeHQS+L+Ro5BGoJuSrWqby3KOtWSt7Vq ob30tA74f32RMn9k1AwUQ2WyuwSpj4pc2c00N/iaiJqj4EqOzQARdhOiECFFx9OHffql 9toFORmmwn1AuhSAL5XsY01AZlHgCzl8QNtkCDByp6I5CStdtyqMSYLuK1UFhaSwcQBS KCaGenDnPzBHOPJF8+Hmh08hJB6MghOwlpng3RS+fdNbJZT+C8/qS5D+jTK6VgKdX5k0 kb5OZlKK/s1Kr/3Lt+ZF2VAH2o1l44jPpVNkqByZJEbYgKLRgq2ZpEN4LrBPNv0tlQeF FB9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=V7d0heHm; 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 x11-20020a656aab000000b003c5a1baf6acsi10088264pgu.503.2022.05.22.23.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:14:40 -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=V7d0heHm; 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 A00FF35843; Sun, 22 May 2022 23:01:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353851AbiEUQjA (ORCPT + 99 others); Sat, 21 May 2022 12:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355413AbiEUQi5 (ORCPT ); Sat, 21 May 2022 12:38:57 -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 56CF662BFD for ; Sat, 21 May 2022 09:38:53 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id o22so12638170ljp.8 for ; Sat, 21 May 2022 09:38:53 -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=qcH7iik2GW8EIkmCTFLKGtsxL3Zpurysxl71BOJq3d0=; b=V7d0heHmQbb0lFT0Ux/CBuPX/IC6qfLxB/rSo6O/O0i9wSVjG5Ip4fAl4/azlz37Qp o0SKGZNBkBQpcTOI1/8zTI3sf1iWzXfHKzi0xD6JmPR/cm6Pd8BvTLtWPhWK+6TIoH62 /O8kcXjU9NyHnKAc8SOHrP9rEgcmf6/rXU0G5vRbKLhfgsZdyFOVelMZjNF0atRmcs04 ZJOc8G8oZX0v36VwWF5fc3JG3qvu3RYUrhI57jhbV6nNKmYcTuStB46lUMnASonXo9nL P1eRtwHn0UWufluLGtrgtVexlM7nrm9RiBAoGwuDNoL3Lb9PCOrTMgfOpLLHajkdUvne AJ6w== 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=qcH7iik2GW8EIkmCTFLKGtsxL3Zpurysxl71BOJq3d0=; b=11/oyD1/nvpe+TDyCgzYvZLprf9bVjlCQ1glowc4bfCNS4bfZToA9Ncz/oDWxJLNud PSCGr6FP1gp0LwKuxLuebKEPYY5+aS6IreXgS4Eny3xBaVdriMWgUB+T8tzz4YW5Qr0x +pkA/JZghBhlHvTtXSQHk3lkOVVYjv9j+6pGTxuWNQPj7QqR1qXR6znAXw+FizZZXNGC 0tfyFiZgn6GC1LK1fJ4CijTopEAoD5bpAkJBX1zj6eE790xG0iN3DUnipKhtC3QMW3P8 SZLkMRG1X0oPZqz3G+pAVO5IFC2LcNnphgJ9xNEqFErIUbmxFbRDPLxGDERjt0bD/fBk DypQ== X-Gm-Message-State: AOAM5306ob+VZ/YdT5IUf6xSvrDs5M7DZSi+fFOqOz0rYMfa4C0sXThs vdZ/UeGUx//fbRJVGLok0Q3kGw== X-Received: by 2002:a2e:8908:0:b0:253:9c85:8cc8 with SMTP id d8-20020a2e8908000000b002539c858cc8mr8241083lji.141.1653151131580; Sat, 21 May 2022 09:38:51 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.185]) by smtp.gmail.com with ESMTPSA id c38-20020a05651223a600b0047855a54704sm641313lfv.172.2022.05.21.09.38.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 May 2022 09:38:51 -0700 (PDT) Message-ID: <46bbde64-7290-cabb-8fef-6f4a30263d8c@openvz.org> Date: Sat, 21 May 2022 19:38:50 +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 mm v2 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 , cgroups@vger.kernel.org References: Content-Language: en-US In-Reply-To: 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,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. 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 --- 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.36.1