Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5964306iog; Thu, 23 Jun 2022 08:38:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szfo0Jp3YOQfCKvqBsEczWhEgUN1SPM1tb8XnPdQYtl4jtJObDt7lGBpWvUSc+qglSxISP X-Received: by 2002:a17:907:7f06:b0:6fe:b81f:f885 with SMTP id qf6-20020a1709077f0600b006feb81ff885mr8922549ejc.621.1655998715353; Thu, 23 Jun 2022 08:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655998715; cv=none; d=google.com; s=arc-20160816; b=jvNu93tn693g5joMqfi4p98+jd+EuZb15vikKZgq8JEZWLGJ0fpbcqYA49/D63Vhxc qNmtw2tULnH4GNve8uf+vk3XHKFoX/D4Z2CGykm3d3bCXin4GCoDgsEQsvtDz4Ha/+XH E6BUDmR914CS//+FeMIP1JVvaeziYWXVMN3SCyAD1cZqMAnx9dHzcgks7P0TaSxwE9qI 7wsk5kg/vbUKd2lNutEuBeXXOOQqlQKFOoDw3JOawejt92CE+2IMSl9TcfeFa2Z2oU0t 27gYPA+ShPk47u9KCqVlGXcnH4bfE88L6U13WGbLCnWHG8pR9VLnHgNvJ/2fwVOfQb28 JGEQ== 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=waMbR4Vj3d2Yx3tC82MaoYQ2maUSxBJAR+0Iakz5FDI=; b=U2rrKiONHKnzQ22o4/x7urAv66cCR/ZbdYVFpd/DzvaF9L3aazMVP6/X4ENisejQB1 Bkv6LpwC8A+Znccy1Wz8149bozit2SDJ+z+Qn9xtquH+t+VNERdlOW7YIa6l+Rjl0Cz0 Uo6VSfk+odbeh50JB0sLJQWmk2BOEgc89gcQWpvaWVM5aXxmEng0O8PZsFHMKiid+sL3 mFyeWSNr0KtZHmDUk0S3SZh/LCs7/eTvmQyncYQ4EZyB82ptJk8XhmPI/3853yOldLeD vPJoWXdV3l16z7lhcfIIO4X0LEyq7ZT00/ROZqy2BX15pqT2AsbDljPRcz0Ftkig5qJ0 6eaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=YNvr4xo3; 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 r9-20020a05640251c900b004355a6d2eefsi25388189edd.618.2022.06.23.08.38.09; Thu, 23 Jun 2022 08:38:35 -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=YNvr4xo3; 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 S232056AbiFWOvj (ORCPT + 99 others); Thu, 23 Jun 2022 10:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbiFWOvh (ORCPT ); Thu, 23 Jun 2022 10:51:37 -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 CD90C47AF3 for ; Thu, 23 Jun 2022 07:51:30 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id z13so3298780lfj.13 for ; Thu, 23 Jun 2022 07:51:30 -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=waMbR4Vj3d2Yx3tC82MaoYQ2maUSxBJAR+0Iakz5FDI=; b=YNvr4xo3AtwQzeXJO0a0Zs/pJf/cfhwOyUbueOMf0dW7rfYbzeNXzzeTckjXHZagnx IL85gF0d8dj8iu8D/NKKFFpKBqeU48c+utRpVkVyvj5DixZAKXeknlRq8N2LyZGOTi+R hGN8BepYHBGzguV4vsrHooHWcagsJSb29bCFzzGcw2QHmp3PiwCLs5lRYky96HtSBt7M EA4L0Sp+aBwKz/fZyvAIqFUTbxk9l9Tji0K20GNE67AGI98/zeiTxuFXgKawjUa1NN+o 2Sces7CzSgUk2DMCdi7DOn11celMtSmNASSbOpBFHfM4AG9IAqxKziAlLGfROZMJkciM MZ7A== 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=waMbR4Vj3d2Yx3tC82MaoYQ2maUSxBJAR+0Iakz5FDI=; b=eVb7q0NciLN4dUwc27r/5JwctJmI3FoOSikRUmfjMBJ2wHmvFpR2wvjQcCyOea6pJw imlsAQSQU8OQmI2zbINWuOtapJSnZAQgOvSnfjJ414CEp/x8yv6FK6qIB4i1BGOx2TpA xRNcJZy++sk2CCTTsxg0LOX2xdathp5VzJXvAULjnpl0RaS9/P/pyLwFRPWOsxy9XtRa LmwokIa7MwyQyqvbe/pawieX8VkMIbR0kFzgzPaVKMK20QlcBj1VrWYWTglIeGsmRnI+ up6C59z0AdlpbYX9/05TZ9+NBJWN1iwZjeBT7wesZD6xmhg2aTUYh0P1XhYL+kPSXVcE 42Ig== X-Gm-Message-State: AJIora9wtyX5ZONdLn5AvLtOPJe4PzE6FswCg4fGraW5ZDC13gOKVIlD /xjI9n8XxTY0H3Gba/lvZPQmNA== X-Received: by 2002:a05:6512:228c:b0:479:7a60:5e0c with SMTP id f12-20020a056512228c00b004797a605e0cmr5584521lfu.323.1655995890370; Thu, 23 Jun 2022 07:51:30 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id s16-20020a056512203000b0047fa40b5052sm354193lfs.62.2022.06.23.07.51.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jun 2022 07:51:30 -0700 (PDT) Message-ID: Date: Thu, 23 Jun 2022 17:51:29 +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 5/9] memcg: enable accounting for percpu allocation of struct psi_group_cpu 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: 7bit 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=ham 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 struct pci_group_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 Acked-by: Shakeel Butt Reviewed-by: Muchun Song Acked-by: Roman Gushchin --- kernel/sched/psi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index a337f3e35997..0da10159d3d9 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -957,7 +957,7 @@ int psi_cgroup_alloc(struct cgroup *cgroup) if (static_branch_likely(&psi_disabled)) return 0; - cgroup->psi.pcpu = alloc_percpu(struct psi_group_cpu); + cgroup->psi.pcpu = alloc_percpu_gfp(struct psi_group_cpu, GFP_KERNEL_ACCOUNT); if (!cgroup->psi.pcpu) return -ENOMEM; group_init(&cgroup->psi); -- 2.36.1