Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5954490iog; Thu, 23 Jun 2022 08:27:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTKJu2FpPa9+MQu4N3uydIcOEV4EBKelEceBFVtkcKJaz/RcWt+8dGScLcAAgsRB7bvYGK X-Received: by 2002:a63:475d:0:b0:3fc:b414:f2aa with SMTP id w29-20020a63475d000000b003fcb414f2aamr7926539pgk.17.1655998065363; Thu, 23 Jun 2022 08:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655998065; cv=none; d=google.com; s=arc-20160816; b=QCubfvR9jOn08NpKfoXtVTsDpSSQ3npMKuPHu42QkOy/2ZOQ4awsY+kC0ppApeSiUn C1VcHNWj44JuJ7XvHe4Pne7CEF3BRXM2UoeWTQmgUu8hBncKizUdkiUXKh78GnvAmN06 QzisNENt0kNHEhK9Ke3jSA8fthZ5jST34tDHEQa293yNgrSYl9mqTX8ZLJRIBOsy+TlX qvz2lPYqjByP3HFBed543Fl6mZ8nGiomui1omk1LS1cm3mnnkT9+m1zq/S3TAFIdswlv vQ4rOkGDuFDEG7saWSfD47iYZvnOPDPhWSz3Sl2bG4p2CVtkTvp0kx3RTh8lzLZsv2Nq OEbw== 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=RJ0ABL9uCwvFv63ZyK8hl1S+g8awXPTVNvHTVH+sSkA=; b=WC1gRs3aBbtJFb2DXWa8TY9lDt/G2OCkUmWcT/C9pzy8ami5POAnX4bdrlVmHxfS1y R2tb6AvnAbcCyXxuIqrB90cibiW4pr45QqYDPZky8del8dHmawHK7tgaQdAv/Rez+sy6 8NfeTFTyDijkXeLkhala+GAnKszvk6zMi0hu5pVMbI5hb4x23pWNm6NzcBU2fnidCJPd Of/NsRn4n7c98lVRq1YjNHpZ8ug1OUAKvblRY5Wzi+J6U56lQ+vcfru+CW1WWDfY+u38 WIvfzooXS3eYIe+B7V4FBSjrTRBVaSOyBnWzXP9uHdGdxLWzMH314exBN9OnuKNq1Zfn FgwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=VgAQKKEs; 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 h187-20020a636cc4000000b0040242c3b826si9882814pgc.865.2022.06.23.08.27.32; Thu, 23 Jun 2022 08:27:45 -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=VgAQKKEs; 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 S232082AbiFWOv5 (ORCPT + 99 others); Thu, 23 Jun 2022 10:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232080AbiFWOvu (ORCPT ); Thu, 23 Jun 2022 10:51:50 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F334739E for ; Thu, 23 Jun 2022 07:51:49 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id t24so21560670lfr.4 for ; Thu, 23 Jun 2022 07:51:49 -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=RJ0ABL9uCwvFv63ZyK8hl1S+g8awXPTVNvHTVH+sSkA=; b=VgAQKKEsiHE7SoRPkk1oRDOCQig2wAGOd4W/o+dF2VxecW1m7m7A8NKaTdjY6rAajT mVPbyprusIoCKB4TPm6SHYIe3KpCqQ4pzIY7CbdHfGyr5ORXzNRmj2PRvHPzPDQPueHn Z76hXIZzwuiGUftMNpZoKoWS9xthi1G7AC/Ew2GNKdBfQqhZ3MUsCmNqCVzvGpl9wzfU sa/0UyQ27uVR+L11DOohImUdZ4+okomUQIW1WXxaGaYIvE/q5N8bZW/ooU71RpIi+Eo/ iAM0GC4i5D9/nVN8TJEWbT3QYi7fwJCEyg7P3n9TS/6boGeH0zIjxQU8xKVtxvk7K9A7 5rYw== 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=RJ0ABL9uCwvFv63ZyK8hl1S+g8awXPTVNvHTVH+sSkA=; b=cL7OAnrtdwTBpN1LYIQ01rnxK6RIPhskT4wLpEmRakhV3BhX9feKvaYsCM5pXbMBhQ u+ONAyRMerfl8a2wo3hrx5/eDL0RSBPGmoFwXy7VcAZzYnzBCEo3IxAupGjTyBLxoV3+ Y/QHgaavPz65/ayCejz86viXgVWbMjiE/dahJ71Y18dvd5BZvxyjXf6cIdfIZ5deVLBt dNXDNefKGSvsVEtnOh0NRK8cBBooYFw7a61tGzxmT6wxU7aEgOmxSZr4LunU1XbkE5uO X0rSsYDMXCfPskDTUhYWX2jqMDo+dhX9M9We5xEn7N4ubvA/GWsGr0Tu5/6m71qpVT8f emJQ== X-Gm-Message-State: AJIora/c9RSOsX5kKDNLgsRXD6NVw/8irpqMURNyFmd6Rdv6vJHIC7Tn BzQBOXuGg+Prc1QYSz+xwWRDPw== X-Received: by 2002:a05:6512:2247:b0:47f:5dff:2eef with SMTP id i7-20020a056512224700b0047f5dff2eefmr5689792lfu.493.1655995907826; Thu, 23 Jun 2022 07:51:47 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id bd7-20020a05651c168700b0025a8ef49c64sm342231ljb.140.2022.06.23.07.51.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jun 2022 07:51:47 -0700 (PDT) Message-ID: <045740af-d2a0-a81d-cbb6-153649705087@openvz.org> Date: Thu, 23 Jun 2022 17:51:46 +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 v5 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: <4e685057-b07d-745d-fdaa-1a6a5a681060@openvz.org> Content-Language: en-US In-Reply-To: <4e685057-b07d-745d-fdaa-1a6a5a681060@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=unavailable 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 85adc43c5a25..275d0c847f05 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5257,7 +5257,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; @@ -5309,7 +5309,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