Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4348247ioo; Tue, 31 May 2022 02:19:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7g0lvSDYOkaFNPoAXpRjRkx2v0DbL3NnAAkRWVV1yN1eSKPHwfSdenBxrG9lYyxwPYwyK X-Received: by 2002:a17:902:8a96:b0:161:d9ca:85c9 with SMTP id p22-20020a1709028a9600b00161d9ca85c9mr59115293plo.94.1653988779025; Tue, 31 May 2022 02:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653988779; cv=none; d=google.com; s=arc-20160816; b=AFqiKtj/bApw9JV+35HROa9TcYwwcQnGjhZafGzWyBtVV107yLinld2w/3LVjn5ViU +X7sodIZ3w1Tc5VmOgrvk1YOwCh3BTFVsmIE3hJI41C6aTyrBUC+Dnggvkwd3/oCFfTE BuU1gbWPdaZBtOAZTgfHyZoaUlmlmUbSZL5KFeXhC87F6hw09kYlZlof/HPubh3XWgL9 KjYacynVMeeXUzK1qPOQ2dFOiz4A+92ZeLMqwUGI/KA+O4LCl+L1AiY21vVDthh1mX1X 3+IjUZWDwdsJEku0yzwdZoenerdhrsKEN5k4ZhTPm8Ynv6WzsXpAjjXvqHBQgWx3l730 nXkA== 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=xFFlfL4fe1ilOdXrhQDtJsKH7Nsk6vFtTN8mntfqwUg=; b=Et7Mt++HwD8mSYWQy5TVDQ2xbwMd5eRPKgVOp19/+P640jf/2bk0t1fVoSpWUJOJYA 9gWq7+8aMbWKgUv0BVyT/6SbMQgx3xqsLdp6Z+FhWfzStJB963YkNMGM8AR1Jxj4UN6E Si+UnGPpLd8UhOHzKHK4a1TYT0SceWJtEJIUq3NqewxooiyqhVqqTW0NS49pLf82+KeX qiBg/OTLpX9WtllDI5Cea2OAiHoV6xSNaVDgzG8nLTlrZ/zzdPbJFyU/Oamv26lsClq5 fPr/yAfh6uBZQfB44XSf3lNdPzXebFdWanmp58/gg5jo4U9gWvj322MmjprEVNiTMdIH y/vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=34zCQZXl; 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 a19-20020a056a000c9300b0050d973da6f7si19939366pfv.328.2022.05.31.02.19.26; Tue, 31 May 2022 02:19:39 -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=34zCQZXl; 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 S235713AbiE3L0c (ORCPT + 99 others); Mon, 30 May 2022 07:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235733AbiE3L0a (ORCPT ); Mon, 30 May 2022 07:26:30 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660ED7E1CE for ; Mon, 30 May 2022 04:26:28 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id q1so11306568ljb.5 for ; Mon, 30 May 2022 04:26:28 -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=xFFlfL4fe1ilOdXrhQDtJsKH7Nsk6vFtTN8mntfqwUg=; b=34zCQZXlG6JFBzjyCw0P2LGetND/flm33L/Fc6uf6jHK6/jEfMO96WNnf7hXhsDOas vlwNhLfTkafo3h9lT+WD69MjpNURqriIr07F8QtefHyBUTaEmU8U483Y1ln8oOuRxbpp LR4GsOA+lHlX1CBAj+3X99k3UES9/06Fbi80YUczOu5arE7/vqr02S58TZWW8WtAQnxc YuucM1hIVCx2HLssP7y2ZKkHD0uS5v6R2fTS4ubTc1FG6IRG4hxPb/nYOG7cDQglfeiH mC930GXFgsHBQqKKrjUzfs6TUJacEj78xhRipAbhjT0duobsK209zKxFbdiBs/Dxk7hO dPFg== 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=xFFlfL4fe1ilOdXrhQDtJsKH7Nsk6vFtTN8mntfqwUg=; b=Ogm//ang0jZYZ2tWc+5FYZXQZnx7fRIT5lEzyGAvp1EoyF4DOsmRiDq0G/Ts4OLuZM XUWOEnGIcYjHardoIPHQod2MrvHrhIb4Z+xuujj4MU7UW+fsuxJ3Ll7RxWA4dGgWMhQi WH32Y2LHg91KyV/lD5YLjTQ8v+NDnVXL++yE+/ORNq4ZHYkIv/MDBcmxgLFsQWoHHul+ Fg0N6coJ0EBzPQxNevhtgIWsp+Df/L13wAI4P2OYeQq37DswJnjGSmv0UUlHW5iJ7P9R TCfKi77uyjlxzAe0QcLh+QjwsnT6F0XB5gv95LhhI7hBrRxVTUF9EwlPS73jr/IYFtRL Y3Cg== X-Gm-Message-State: AOAM533xlkaGRcx6pqR6gZkzSsDIZaP5GrYmjmS6sRmQTmfpTuc/q7lo MYF2atbnf6UsgYmBsnDhms4ROQ== X-Received: by 2002:a05:651c:98c:b0:253:cc50:4374 with SMTP id b12-20020a05651c098c00b00253cc504374mr32878860ljq.274.1653909987912; Mon, 30 May 2022 04:26:27 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id e28-20020a19501c000000b0047255d21130sm2259269lfb.95.2022.05.30.04.26.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 May 2022 04:26:27 -0700 (PDT) Message-ID: <14a70615-1240-9538-8be9-b2aedcb0fc11@openvz.org> Date: Mon, 30 May 2022 14:26:26 +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 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: <06505918-3b8a-0ad5-5951-89ecb510138e@openvz.org> Content-Language: en-US In-Reply-To: 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index a337f3e35997..f3ec8553283e 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -957,7 +957,8 @@ 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