Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp179524iog; Sun, 12 Jun 2022 23:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNK1jz1Wg2VSEq7saUzzs90myUEdbAq6LSOuTwZJ/ELMTaxMJl95GDwV2XMHu2w/6Wl93E X-Received: by 2002:a17:906:118:b0:715:771b:251b with SMTP id 24-20020a170906011800b00715771b251bmr7758047eje.651.1655101588204; Sun, 12 Jun 2022 23:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655101588; cv=none; d=google.com; s=arc-20160816; b=otxh2/Csfjb3V9CPr1zfg8gc7KLBj0XEPveBF+ZI22A6BI+EwniAO2DSwJaRRQDfl4 btk3D8/gg8uK2msbw5NX3ifnXdUltjgaMXULJUjZydYRpXrgZTKvyBx1qZRG13Ucp24M 3jnIAY15+jRSE+GTrjLRdCtKYBE6QOWkrp7basO3uIrfY/uAClZ9rO1ICQymVvRM0NKW Z7vsQRLy+SKfUOWL3eTqjq5q0osCEEevCkLXTorrrTytOtZNmlV92pNhyp2wsvz0OGPC 3feugklqJcm8iByPuixEtoXbWCCE+od3TKiAPDOo1VUzolTQ9uGCdS195CE8vDTAwb2e 3jaA== 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=LySdGa6WSWuP57DyggEJLR/XgrjUl+fsCS3/BfNoxBo=; b=ctadLuOM2zdOWlNgBtoQ7NqI+GddbzdBQO+Qp+DhN4qEDl1crDUs9AvFUEpf4W0SLE 8NLPjB+FgDcFD60l/LHPpLnjWTOREI6VQUj+26WgP6zyRRSocM14lWat/R2SKnKEQm58 ruhm8pXMsN5B/YVe6AM/Gc0/VgMb/U2nw0HBP79MlwEbIVKgx6KufSuuOZbFzS7TesiG tCyWV3ajzinnx1nxPqtstgbCytCO+zxEu06X4Icm0mMkf8WZTyM1raiPd5EfJi97UcZ4 LrXI2JirVEtwtPpFbl58CQaSO/M6iM68zoeqbLW9uf0jQmNdtJpGc2tKxIqL8ZzpZ/FO ADGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b="MMQLuUr/"; 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 w6-20020aa7cb46000000b0043350578b95si7137819edt.142.2022.06.12.23.25.57; Sun, 12 Jun 2022 23:26:28 -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="MMQLuUr/"; 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 S233011AbiFMFgh (ORCPT + 99 others); Mon, 13 Jun 2022 01:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbiFMFgD (ORCPT ); Mon, 13 Jun 2022 01:36:03 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE22712A9E for ; Sun, 12 Jun 2022 22:35:36 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id h23so7138107lfe.4 for ; Sun, 12 Jun 2022 22:35:36 -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=LySdGa6WSWuP57DyggEJLR/XgrjUl+fsCS3/BfNoxBo=; b=MMQLuUr/04JdD6h+bOSVzq6FkKGW1jK4dRUQ5RRZgULnPkx8ZPAbdMfROKB0f01oM2 xtYIkf9112uEUuIkZV/zBrk6d7Ru8iB3LRi1ee260+FrR1jNCqxsW8hBdTa4M6TVqb42 PNJS7FJvKSSTEmrzL+Jgf91ADt0Ca0zpmxEJhBKqzC84MYEsuwd+4SSmote16X1Mvqps kvUAWAoCgOTXygT1y7N5+eb0PZ5bGR63mHbra6sZ3h+5LaEY7aZRoJ9G2vwSfkzRDk/M otgCOEA+Ecp2xbajvZSrKQmj9agTuFAAuD9tN2aAfrcL5UdcrflBlsakdQrPqksA4xT9 i+GQ== 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=LySdGa6WSWuP57DyggEJLR/XgrjUl+fsCS3/BfNoxBo=; b=tNRlCgeYD4B/75f1WWIXQn2YcOpk4YR1xTdGQVjefzj3cSXdXCavsiXS2hLAUEjIPx IaHHMicPb+5YvIwTkiVerLKPIKvO2xXQHiUx13KRNsJlPt6qrLii5FECYwRKf3Cz7Fh2 xKChit9vmECT38dDnqkZerZE9PqJuZfioPMPyltcKQCbT9ugPvim7wd836I6TIZCwEcs APUef1nz+S7red1sQdiKhJTk/KFm6nUGyyLIHY/t1In0ew1Sd5u891JR48tqwRvfGbrU 0KoBXBEYxwDArE3SFTYwKuKRWMkecErcSQAJKWha8VkrPEMnBpIUu0NEsmrFvDmfgZen 9f7g== X-Gm-Message-State: AOAM533nBCQXH9l7lZMt6HBThmQdllcZZk6Vc1hn3sPyQjbG58Q9AjrX UEc0FLowtoMZUXy6SSMjm28OJQ== X-Received: by 2002:a05:6512:ac6:b0:479:2bdf:749 with SMTP id n6-20020a0565120ac600b004792bdf0749mr27273040lfu.686.1655098535032; Sun, 12 Jun 2022 22:35:35 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id y2-20020a05651c020200b002557df3669bsm880245ljn.21.2022.06.12.22.35.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jun 2022 22:35:34 -0700 (PDT) Message-ID: Date: Mon, 13 Jun 2022 08:35:33 +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 7/9] memcg: enable accounting for large allocations in mem_cgroup_css_alloc 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 Creation of each memory cgroup allocates few huge objects in mem_cgroup_css_alloc(). Its size exceeds the size of memory accounted in common part of cgroup creation: common part: ~11Kb + 318 bytes percpu memcg: ~17Kb + 4692 bytes percpu memory: ------ Allocs Alloc $1*$2 Sum Allocation number size -------------------------------------------- 1 + 8192 8192 8192 (mem_cgroup_css_alloc+0x4a) Reviewed-by: Roman Gushchin Reviewed-by: Michal Koutný Acked-by: Shakeel Butt Reviewed-by: Muchun Song --- mm/memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 27cebaa53472..a8647a8417e4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5086,7 +5086,7 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) { struct mem_cgroup_per_node *pn; - pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, node); + pn = kzalloc_node(sizeof(*pn), GFP_KERNEL_ACCOUNT, node); if (!pn) return 1; @@ -5138,7 +5138,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) int __maybe_unused i; long error = -ENOMEM; - memcg = kzalloc(struct_size(memcg, nodeinfo, nr_node_ids), GFP_KERNEL); + memcg = kzalloc(struct_size(memcg, nodeinfo, nr_node_ids), GFP_KERNEL_ACCOUNT); if (!memcg) return ERR_PTR(error); -- 2.36.1