Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3298781lfo; Mon, 23 May 2022 01:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8y00IKDmFH25KT61u3u4WTx5A7ZgxzdrbF9anGajbbLUEJ4A6xGJ3UlMl4ODs2ZyCVWQv X-Received: by 2002:a65:428c:0:b0:3db:822e:2163 with SMTP id j12-20020a65428c000000b003db822e2163mr18926869pgp.466.1653293005144; Mon, 23 May 2022 01:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653293005; cv=none; d=google.com; s=arc-20160816; b=bApWSDS+vkn+hRdab0bCRiCYaf/OO7492I1P9j4E54O1qS+DxEtDp28aZ18xgy5G0W 6/HfxRqBaDUg6rGiAQPwzt8l3RW+6RhP/TRIkIDnlCO/VUnVykFEIJigRwP30X8yl8xC VorpsKi2D5C1hcX+pQhyYEE0JREPGZvWf3Ki58jtNYifAi5gfOOc/OXvQ40yplKYWVhN CVH8qfOpEc8TulaznYGyWl3aowOmt2tVraaxI2SVsF8QsGcO0VfTxNnsAFMfXed8UHU3 iSHKBmR8SfmWHn8jNYa8mKF9MNkG+zJ0GTFgDVvlCwDwCLSTROeQGShfSZQxHkZZ3w/n 0BKw== 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=eKY7dBXMF+LF1efr4OS98ZF9YSsGHBm760SPqeFCaAs=; b=fivSWOBzxsb8QFkWQFY+Tdb79nwIF9mS3a0vI2V2fs7lpMr+JqxkotSHVnPBZN2Snm XO3shc86/PhO9/kE4JaZYcq0vVXoQht/QH8HOJ1reMRpKmDfg7ySGzcR2sK0Rvi8gUBh n6mMZ/cTN62pULuZClpisLIVnIDqNertyxirFrCqlYiy/W9a/XOVvJcMtQ3WTNOfu7O2 jraJdB6WjH13o4q+jFJq+sjhYRN1C9fFpCS2MsIQXLBo1C3VVvpE8ePoiIJkcrQ/n3Pf Pgc+2p11Myxeczq/RYPIIQ8bc13o9eVJSDwizpWwwPgjxARcdDyVixf5nU2d7HWBA+jj 1kFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=Vg+HXKWz; 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 c20-20020a6566d4000000b003aaa7c6cf64si10967867pgw.216.2022.05.23.01.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:03:25 -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=Vg+HXKWz; 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 5F42E11CB4F; Mon, 23 May 2022 00:02:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231387AbiEUQiw (ORCPT + 99 others); Sat, 21 May 2022 12:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354666AbiEUQir (ORCPT ); Sat, 21 May 2022 12:38:47 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 449BB62BD6 for ; Sat, 21 May 2022 09:38:43 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id w14so18947553lfl.13 for ; Sat, 21 May 2022 09:38:43 -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=eKY7dBXMF+LF1efr4OS98ZF9YSsGHBm760SPqeFCaAs=; b=Vg+HXKWzRy6K6ypOrMl5as2kxnq+YSAo0DuRJ7Kcacy6m36tH68eCqgWBMhwtoeZ1G tv4yq7SeY3Q0gN7YPHnBgcPqW9hYj1tXlfNleVIA9e9hvddDiOXmhlurzFJt1ZzTBOqd nBL2/f0rtnmLOOsYpRbzlMbLW46vEqgqyEF8zXqk1bnGWP98l5gvlyPbc0JiExSdKRCC W4GK+RqAmZ+4i/O+SQj1HybVQeWSucsi+kYj2to2yRsjZtjtzwph2nvugbzHRVt5UiJW NquvazqC8mbbKdg6OLw0b2uuP3N4dkrHb/7+XItkGdRL78b7YH4uivPmV86g1mgBoygC CCtQ== 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=eKY7dBXMF+LF1efr4OS98ZF9YSsGHBm760SPqeFCaAs=; b=d46lzbRjD4uiq+mqKdBU8KUyzo+l4HnoWZ7//ucU9DxEMHa7dyn4uNR3g9/BO/H3co kQhufWEfJdl+5RPePuB1DffUmB6pI+JRAiE+p1biZrl4S5DhlGilM7SEovATc/hHcRoK Z3jmHYIc/bl6ROMQHPnC6C+xFyNTuHnGCCHiF5Ahi047ESvl/C+RsDulK7cYayXGNzaO MUPV0bLaxXi1rdWpTiTBVqeWwTPpyo/8yC5T90lr6wlHDPQB8CSA3zveXmRdTfZ991Bs ofnfx4yWP/iotP9fwWCyN5Bqdzw4ymxzV6JX5Y3RJwB6gap/HALI4kqlz0ltOddM0gT3 1JFQ== X-Gm-Message-State: AOAM530ynsGSsJxDs8C8K5tBLZaXH35ktH+FRAYSkc3C0nTRxsUI8IJ1 iDybpdm9LaFOFUzyKlconTYLNA== X-Received: by 2002:a05:6512:260d:b0:448:35d2:f72a with SMTP id bt13-20020a056512260d00b0044835d2f72amr10926563lfb.515.1653151121595; Sat, 21 May 2022 09:38:41 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.185]) by smtp.gmail.com with ESMTPSA id x7-20020ac24887000000b004742b9065c4sm1113439lfc.230.2022.05.21.09.38.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 May 2022 09:38:41 -0700 (PDT) Message-ID: <9925d0ba-40d7-e3a8-1fef-054968b26ce6@openvz.org> Date: Sat, 21 May 2022 19:38:40 +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 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 , 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 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 --- mm/memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 598fece89e2b..52c6163ba6dc 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5031,7 +5031,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; @@ -5083,7 +5083,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