From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B904C43334 for ; Thu, 23 Jun 2022 14:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbiFWOv6 (ORCPT ); Thu, 23 Jun 2022 10:51:58 -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-Google-Smtp-Source: AGRyM1v+wrtYYFhb0JXolKG7l98gJTFPDw4sPts1HZmI4WNoqYhmZ/QU9LxTvX7ieU9TzkpzKZmNyw== 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 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