Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1662014ioo; Sun, 22 May 2022 23:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaEQ7GIxjOXHQ4PCpP08XwaSIU4OBoK/0JPTegVg2o7pdVFDWT77l4aERI5x3omIekFijr X-Received: by 2002:a17:90b:1e02:b0:1e0:2060:f27d with SMTP id pg2-20020a17090b1e0200b001e02060f27dmr10728735pjb.22.1653287316508; Sun, 22 May 2022 23:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653287316; cv=none; d=google.com; s=arc-20160816; b=FOb2JQRaj68KfBBje4jg4mMI8fcEBl8kev6B3aEQW1a8OCqjnG/zKXt9iqCcRY0mud ovSK9PVta6m7zM0cuFu1MvkVfoXfrsBLEW8Kn79aycg5/5Gd9gQ8LbDIaU69a7t4B3uq o5KEON5BmPElGBAtdJB5DZ3c0cVmiYzg2uo2nnjlxC2VpCGRGe0XwxWwO2+z/HL0UU2e Miug3ZpgLW/4Hy4PUNpWACIvIF1ZkbjZ4T45RGhxdxUT1uxewNgohQllMDBvL3MVoPav 9y1Iqvia/CYw5oa+xKNdDbQLDW6ZgHuM8f2KVJB30NxcMRHRppyzPoVHLfxiqPv7WaWn Utzw== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=Q66Lzs3M5kOo/8VJybpmTwF9IYF2g+3dQsdn1hpx9NQ=; b=ezWDv7dUZ/tc2826wX6iFV+c+bSaytfK+STmYq/oZC0p1fodqtwGXIzJYAF6+KzJAt WL4nkcDY7thHs2u55g8EtvmacZ3o7GlWEK5kBvB5v9hBs35CtuOjIp1+TOOAurf3wpU7 w28XxqVPZxS3ibRWwhR8NMK82V2YdM5xiutX24LyTOqcmbcVraHMc5+9ZLPZDTX7IIfW bwlBmu8qwrgPpjf7bJqdJZ7hLZiuMdnlc8oGmsvD5Fycs5HcSVfVuga33dy9JQvnSSMh dySDyY28/l0L5uzgxJtkMBSb42o12+AAaSuYpBRbgR3UC+wTnt2z698CELLzERuNGojx fGyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=QCTfmXQG; 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 k17-20020a170902ce1100b0015838c0eedbsi9430550plg.506.2022.05.22.23.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:28:36 -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=QCTfmXQG; 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 7471C1403C; Sun, 22 May 2022 23:06:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344236AbiEUR6p (ORCPT + 99 others); Sat, 21 May 2022 13:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241182AbiEUR6k (ORCPT ); Sat, 21 May 2022 13:58:40 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E774A66F90 for ; Sat, 21 May 2022 10:58:38 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id w14so19133642lfl.13 for ; Sat, 21 May 2022 10:58:38 -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:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=Q66Lzs3M5kOo/8VJybpmTwF9IYF2g+3dQsdn1hpx9NQ=; b=QCTfmXQGadwwlQM7hEIdm50KOXHwYga0OF/NGlbgOk3004UEHV2j12kft+vGwKwWir wRilZT8O9unVC1Xau1Q/xJ/oXjKUn097Ca9N477mVVb4T+K+qMPT9zUfhK0U696onLrH 0os54gYtDt7QmTh2QJVp0zVX+VOwBBN3tTEji9jfwScy0wauB/MKvMR9weEQeZu99gcl S6q0/FQT5dVQFSiYwCJOEzJUVh2eXtxNXRkNhlzUj8VPMJ4+JVhxhMspOoclfnBCfr0o JdQNunNe+PYOALJWx7fSQNgpOjodEVLFipBmw9+pinSFfPkeFtfzzVFHvhyVXcuEKFmZ Cu/w== 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:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=Q66Lzs3M5kOo/8VJybpmTwF9IYF2g+3dQsdn1hpx9NQ=; b=1iCzhwrc/eyilJUsvzoBwX3yO1ACz51OFvRFABnKmqQ9GrkOyokh0WF58VWZ6RZtlp VUjEyv839vQUbdvyD3cc+Pc7jxQt8ud3fiELQxbcIBQ1Q0V82m4vRtdEu/K64ARJsdg+ 0QZGID8BmkUTZCezStyf/Wh4dIOvM0thAJZUlELWhl756tYXuisxd9ylnTV0xhO+5YVN RQ2Shd2uw+6GAmJ+IAO/EmaeOrVNJXkzALJKdLOY3CLaoFmHGotZ5Uz1tG6ik32sXgiL +WD7A8N1IZ5SqHVJLOFOzICGFFy1Dg22bxB4JyzNf3kXuB/mmA9ylUWPWer8/L3ku3oo cKaQ== X-Gm-Message-State: AOAM531fxZLywId58jyjccfOG8rGwiYx5v5YJoCKuGLpfiKrKFEezHPc 6wcAmK8NV/EfvXsRsLnx+wCkNg== X-Received: by 2002:a05:6512:3403:b0:475:afe3:740b with SMTP id i3-20020a056512340300b00475afe3740bmr10998844lfr.436.1653155917305; Sat, 21 May 2022 10:58:37 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.185]) by smtp.gmail.com with ESMTPSA id r5-20020a2e94c5000000b0024f3d1dae91sm799624ljh.25.2022.05.21.10.58.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 May 2022 10:58:36 -0700 (PDT) Message-ID: <6c980ae0-9731-ba89-d04f-cd55a6badc24@openvz.org> Date: Sat, 21 May 2022 20:58:35 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH mm v2 6/9] memcg: enable accounting for percpu allocation of struct cgroup_rstat_cpu Content-Language: en-US From: Vasily Averin 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: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,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 On 5/21/22 19:38, Vasily Averin wrote: > struct cgroup_rstat_cpu is percpu allocated for each new cgroup and > can consume a significant portion of all allocated memory on nodes > with a large number of CPUs. > > Common part of the cgroup creation: > Allocs Alloc $1*$2 Sum Allocation > number size > -------------------------------------------- > 16 ~ 352 5632 5632 KERNFS > 1 + 4096 4096 9728 (cgroup_mkdir+0xe4) > 1 584 584 10312 (radix_tree_node_alloc.constprop.0+0x89) > 1 192 192 10504 (__d_alloc+0x29) > 2 72 144 10648 (avc_alloc_node+0x27) > 2 64 128 10776 (percpu_ref_init+0x6a) > 1 64 64 10840 (memcg_list_lru_alloc+0x21a) > percpu: > 1 + 192 192 192 call_site=psi_cgroup_alloc+0x1e > 1 + 96 96 288 call_site=cgroup_rstat_init+0x5f > 2 12 24 312 call_site=percpu_ref_init+0x23 > 1 6 6 318 call_site=__percpu_counter_init+0x22 > > '+' -- to be accounted, > '~' -- partially accounted > > Signed-off-by: Vasily Averin > --- > kernel/cgroup/rstat.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c > index 24b5c2ab5598..f76cb63ae2e0 100644 > --- a/kernel/cgroup/rstat.c > +++ b/kernel/cgroup/rstat.c > @@ -257,7 +257,8 @@ int cgroup_rstat_init(struct cgroup *cgrp) > > /* the root cgrp has rstat_cpu preallocated */ > if (!cgrp->rstat_cpu) { > - cgrp->rstat_cpu = alloc_percpu(struct cgroup_rstat_cpu); > + cgrp->rstat_cpu = alloc_percpu_gfp(struct cgroup_rstat_cpu "," was lost here > + GFP_KERNEL_ACCOUNT); > if (!cgrp->rstat_cpu) > return -ENOMEM; > }