Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4353896ioo; Tue, 31 May 2022 02:28:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/f7jzWH7Lm8nw7+Dqt3yzXVSG4rfH0+wknYe8KeHQzhuk4Kx4bOlNt5+kf4K712DJZ2gY X-Received: by 2002:a63:d507:0:b0:3fb:22d1:8a51 with SMTP id c7-20020a63d507000000b003fb22d18a51mr19890611pgg.377.1653989300736; Tue, 31 May 2022 02:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653989300; cv=none; d=google.com; s=arc-20160816; b=JBcxrxMJSyF2mZpT+RW/AjEkaKdKjjz7l93Ni/2bOOgbN2xEFPqChXiZ3YXoLILgS1 BEVTttV8FNMK45apH3mOP+ZMfEfW3RlrtZMKCketKpftfCjTiDdSOKnJS2YeLRk0Xv0A HOTQ6nezuJbZ9WDih14E/+XQkcykuJk0/V5NGpd93fF/whjDbtMK72Nzr/kewwzQa9G3 EgYQsAHor0YBpYBmaaDNBcUa6qIe6USBEezh/UP1euDwLLFzQxOQhojmn5R4mQxIiull +8SLJu+Aq9aAm1D8alatiV2Yak0medENVtg5oE5W5u7S4RVHDS20aGKmI6pqI6E1dKd+ Jjlw== 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=4e9cAQNYvP51hKc6KpBonPtXgR81jEqGpiEVOIyf/5s=; b=GM/ntHeTbEgIsT5ccKeciuKEwkkkw9SCOXbI9FQTQLmoTjbiGsc56sTGSUYBo/dW8G 6ENRCIsMFUMy3Mf7DGtTabPJ4qSGkPwYkvxPL04G/LAOHYSSiM65VRXS+Xo7QSAFHkx2 E+VujGBQo5nEbkvy4ZbXQ9MW3GpihJwZLmA42PBTttJ33t4OtHjS2cZKavLX6eyu3n5R odCvLax/Z5jWHXGLPOHJlhlneYNVs/+hnmptqnbZbuS2DwVEO/uTgXTq3oFMr+BqEW7B iUu8XaKJ3IqYZ1OBw6jm3VhEOZfv4PbSB0jzUQCzkYuQtjo05eZegQHTTlGmn0oJfKjZ MVGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=xizF6KRy; 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 s21-20020a170902a51500b00159071eb8f6si16676082plq.502.2022.05.31.02.28.08; Tue, 31 May 2022 02:28:20 -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=xizF6KRy; 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 S235750AbiE3L1F (ORCPT + 99 others); Mon, 30 May 2022 07:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233224AbiE3L1A (ORCPT ); Mon, 30 May 2022 07:27:00 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB213FD9A for ; Mon, 30 May 2022 04:26:53 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id u23so16306481lfc.1 for ; Mon, 30 May 2022 04:26: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=4e9cAQNYvP51hKc6KpBonPtXgR81jEqGpiEVOIyf/5s=; b=xizF6KRy3bFdr7qqwILsD9GKyKXrT5rRjnCMU+4tebhEx+64CxYJbtIbvsChGeZp9p eSNkgCkAudTzd3EKloNzUi0JiC3932qtJlaXk1tfWhx3CZo0+1/dlrPo2A0+4lDBNj1/ oy6OpdKdMux4+Yco38Cdoh1Ak2+Q7U0JVjDpaDnR9IQhAyAgrDsDlmf9XZ7w9jnPg8hZ 6lVTYkwk7E555m7EJX5Ebmj9BJHMo+oyNavkwL/xerfAMHsVuJKLEuhAr+reY72Zpvms GKxs7z2KmJmMOOMUjpCHbYKh3Q965rKnTT3EtDdZNmVh1yEu4+GEDLRkHsOXns+JVJmo onaw== 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=4e9cAQNYvP51hKc6KpBonPtXgR81jEqGpiEVOIyf/5s=; b=k6HJtawU8D0fczX1FBb1qzq4DKY59V+QvWHIV7zQItJJq+b5UrvmQjqot2edr4HGLY GRRYi8wOntjfrFkLJpEeALnJ9Z8+A/N5WERQFqF4db4Xp1n9KwI/eB5cMQpIrQRqXzc4 JY3Xal2X1gejtFd/kHtwkzfk8Ef3yhzOmD6J1ur4PPo/jr6t84dFLV5Shi+u+DK2LTuP FIgryyHifV4bCyHXOI5+fUSp3b9FwJBGIu7VdDjLExwkBLKSP8l1S1hQnqVLFz8HflEI 4OcjjSfuWDtwrLsCFaCYYZq32BwiBmBH2dUrlGlHjhJSu8be+D0JrnhOvFXtR3fpaMNy i+Ng== X-Gm-Message-State: AOAM533st5rx3xJ3Q1CmSiSfuIDpEM4n68KD9qo8njhQBXwH50Ajlcpn By/Q6DaQGFEkH+3XlwoTsBOuWQ== X-Received: by 2002:a05:6512:31d0:b0:477:ce21:fa6d with SMTP id j16-20020a05651231d000b00477ce21fa6dmr35830913lfe.219.1653910011534; Mon, 30 May 2022 04:26:51 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id be10-20020a056512250a00b00478cd831077sm1308038lfb.271.2022.05.30.04.26.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 May 2022 04:26:51 -0700 (PDT) Message-ID: <3b524f9c-c078-1118-9385-7e57cb5a0347@openvz.org> Date: Mon, 30 May 2022 14:26: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 v3 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: <06505918-3b8a-0ad5-5951-89ecb510138e@openvz.org> 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,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 abec50f31fe6..376734af8935 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5064,7 +5064,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; @@ -5116,7 +5116,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