Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5952628iog; Thu, 23 Jun 2022 08:25:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vSG2A81vZ/SnEo8JbUdODckFWt6LaXNQGr0Qg2Nso7OewJG0kjZ02bSDDuFwZkUz8q6ZJ4 X-Received: by 2002:a05:6402:2806:b0:431:87c8:b45e with SMTP id h6-20020a056402280600b0043187c8b45emr11647264ede.130.1655997944136; Thu, 23 Jun 2022 08:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655997944; cv=none; d=google.com; s=arc-20160816; b=yZruIFdVgnf2FHn1xU4cAAsl//bbeX9SRGuZOEgdiee/9HgV+DpLE94+CyPL/qNf8m 2c/PTIlKPEBQ92sPcAKjBlM8xaNh7YY94xf+OCdmA6uIEG13g/4ph24RhYPEeyb+sBmm qqeS+nS0P3YGil04OHCo4ETKgATi4WUuLftfkYviJBzlHyjpvGznSKKsNvqu2RMVxyQY XMWxrwARa9ft8Vsejm1dRao4M2rcEIvnx4bfjl3t6C+awST+n/eVO9mDN8biNDMToxMy 9cup88pR/zPNCnWx497KV5kQZLCfCLiJ0oSs7NiL5sabsI0KmvzAtS8CQ4B5euHw3RNG GURw== 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=GpreIe1vVrFK0GRTTTBCrmu4K38+/AoKp6X51SotBdU=; b=GGs+Ekm9O0yVevOFTmVSs0A8jSFJedjaX9jkNKiA3vzHjC7TK1L87hKx+s8bvAQDgm qai14GgFh/TJhQ7HOMnj/EDykEAz7knn6ntvCoi6uQBUEE89pjIEr37X+V25Qvujy+oN 8n6lfKpJu633IfeuDmOnfDQ/8LdEmy7a7hUjAOIC8GJYyQO3ciG9PNpdU9QR9ue/mKDp ygBO17PYHc8KshBGyI2LGI67/3QR+SwuxDlP0761oF1TvDwIvkWuspsjacq0kHbATiyq wK5FCK38fJnky0s2e+bPfEry9D57kT8QoexLuY9hVFpLA6Ye/IuNO7Vn5PyY7Rx0hIqa 3SHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=2uzehPa+; 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 dt9-20020a170907728900b00711c8193ce8si24862211ejc.21.2022.06.23.08.25.16; Thu, 23 Jun 2022 08:25:44 -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=2uzehPa+; 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 S232228AbiFWOw3 (ORCPT + 99 others); Thu, 23 Jun 2022 10:52:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbiFWOwH (ORCPT ); Thu, 23 Jun 2022 10:52:07 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 893294833B for ; Thu, 23 Jun 2022 07:52:04 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id c30so23591400ljr.9 for ; Thu, 23 Jun 2022 07:52:04 -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=GpreIe1vVrFK0GRTTTBCrmu4K38+/AoKp6X51SotBdU=; b=2uzehPa+7Yh1/1yI1Z5UrlQSBeyJcy6RsaVimJTiqlPLLRwUTOoHga1Wb1egu6p0wr H4yVijZAlfpr1xU4lEH1LNys0LFqKbKhTvHcKfJN0QQnqLklYEEUW4JNuFdZP9h1Zlmu pgUzAi4h5gzZMlV5HEAx9NHHw8mHh72qr5FZF9tx+uUOCdvUuPNtzgsxyZItchwHqvwc 27BKuqvxrJvJkYcdvswWerNHUVfq4ecN5rBvXuLkqYoXEhXdLKw9vWYgZvIb6gFgw7Ec QNjDw3kOBNAZtq1hleAu9lG2BqZJu4Y1MITm+G0yIj7c0AYmDdz9vRi8wuTMvlSLeK+8 uS0g== 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=GpreIe1vVrFK0GRTTTBCrmu4K38+/AoKp6X51SotBdU=; b=4QjUnY7JM4fxue/gTbuoLwmrzmVboF4cWm5TIW0mpDVNehUWKMOAryYKcIvMp22Ioh GbMZs9b4iyhz/n8MUX9FCtCfQo7ACq6QewPJx2P/IYVk8QDY4jNgxeLUdLV+ZPggzKN6 0j20GMbT957DWrAT3skwLze3P4PQ1pCO6Mb5wE6HkfSjFLkp5+Y2b/E0sPpGlLSfq9gg /fn2YXa1l/WgfDvXuW/uYJmo/PvEBCtSjLJfJzkS9Xa35ujnFz7DY5yUNiHoM7arDLJn kalsHZAWoyR852o5haRJ9Yysznbl0XnCmmbTufgQQ05+ugh8E+4aA6h6w8bJcQt3ha+U 293A== X-Gm-Message-State: AJIora8Z6wlDWW7o/OgubcJwOmRsfwRSvZVrc6H5h8GTqVM7KjlLrxYa 2w6Nr2bAS5mkX/2WVXuINsBFNYUSCjSFQQ== X-Received: by 2002:a2e:2e07:0:b0:25a:4bb3:a2c2 with SMTP id u7-20020a2e2e07000000b0025a4bb3a2c2mr5083546lju.450.1655995922945; Thu, 23 Jun 2022 07:52:02 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id n16-20020a2e7210000000b0025a6f7000c0sm1547457ljc.11.2022.06.23.07.52.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jun 2022 07:52:02 -0700 (PDT) Message-ID: Date: Thu, 23 Jun 2022 17:52:01 +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 9/9] memcg: enable accounting for perpu allocation of struct rt_rq 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 If enabled in config, alloc_rt_sched_group() is called for each new cpu cgroup and allocates a huge (~1700 bytes) percpu struct rt_rq. This significantly exceeds the size of the percpu allocation in the common part of cgroup creation. Memory allocated during new cpu cgroup creation (with enabled RT_GROUP_SCHED): common part: ~11Kb + 318 bytes percpu cpu cgroup: ~2.5Kb + ~2800 bytes percpu Accounting for this memory helps to avoid misuse inside memcg-limited containers. Signed-off-by: Vasily Averin Acked-by: Shakeel Butt Acked-by: Roman Gushchin Acked-by: Muchun Song --- kernel/sched/rt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 8c9ed9664840..44a8fc096e33 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -256,7 +256,7 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) for_each_possible_cpu(i) { rt_rq = kzalloc_node(sizeof(struct rt_rq), - GFP_KERNEL, cpu_to_node(i)); + GFP_KERNEL_ACCOUNT, cpu_to_node(i)); if (!rt_rq) goto err; -- 2.36.1