Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4522699ioo; Tue, 31 May 2022 06:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEEy8TmUr+V0kjoVVRzdLxy6SfGMPCC6+UJ7MPQykzj+gH7cmW0W5QovhNw3d78+Ika2Hx X-Received: by 2002:aa7:c54b:0:b0:42d:be18:c261 with SMTP id s11-20020aa7c54b000000b0042dbe18c261mr16510736edr.267.1654003332755; Tue, 31 May 2022 06:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654003332; cv=none; d=google.com; s=arc-20160816; b=fg0P/YYFiobQBxm9BfzWGk5vqMUIfYOFWe4IhiYI9gmuaHO8Ya1eiJDtvBkw5togDf J2YtIio+Aqv2/xl1FZ/QR99o1QetZbCKgu32g8jv3gWLFprd5QkCGljW+4ar5RfS8IVB ruyotp9HObcyRMP4bl0u06q3Y63isk9dMZojQYVMgv4vYNM7+Dqlaxd191Oj2S710tGj 0Q9ihsgBTlibZPiQjQtHg+634kAIaoDanyOe4KVfv68/a8ggRWhhUiRMlFDsO/IOz2Dr j1dvZuYdK9VMA81W36J/OpezCNQA0VHpIWDIJOjPUrGaENYdo9qT6rEmJTRA57y86tUJ 7gWQ== 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=ZH9yvId2NMAw4oN1iqMKqU61/DZ/rIDZexlE6dKv8SU=; b=T2lFyw3KzVG2+BAwIgFe1erd83uLSZaTyOy0LYtNMlxZ+KKSU/Ha8lYFGHwlOSUpr2 3StChLOicFoKaC4ulQWgFzpJKwldnucBzqjMKUQFkfEX83Igs8qjSbywzDIpT5fpj5GO lRaJKlAaXljr5yw9avYiva7oWMyFWMi7q456yvvZrvQA78O7mknnkJg8B6laKifiZxVH DD3B53lhCVps5pJSTnGjl2eTV4/sNSux84yfbQLMrJrl6a5CcgmCqLmxWScLw80slmM5 P0JTeH7Ba6oB84xDNr4pHOiVuC9jU/fu2nCKvo2Ir/5lwPjjBcc1dMw62c3RnfeXBtsN xA4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=qSiaNr2f; 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 dd4-20020a1709069b8400b006fef8e8385fsi18546428ejc.467.2022.05.31.06.21.45; Tue, 31 May 2022 06:22:12 -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=qSiaNr2f; 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 S235772AbiE3L1i (ORCPT + 99 others); Mon, 30 May 2022 07:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235787AbiE3L1O (ORCPT ); Mon, 30 May 2022 07:27:14 -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 C6C094C7B6 for ; Mon, 30 May 2022 04:27:09 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id l13so16185341lfp.11 for ; Mon, 30 May 2022 04:27:09 -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=ZH9yvId2NMAw4oN1iqMKqU61/DZ/rIDZexlE6dKv8SU=; b=qSiaNr2ftUqSRvmOy75IJeNCKAVgq/jO6yIuIwj9lTeotjFVJ4+oMFaIk5uft9Qvbs l+4EitDawXs9/hDAY1ZW4DMfHukqi6UArXkOO1Fsh++NpRhYgntK5BVNeajvyod0xNbd /yEKhndXFUITINHf3AsuCHklX308rL2W0TxU0lyGgS31a7Um1/qC8RkNmyIWqmdjEZqv sBD3tvK7pX9DrDUQh/vJKdquM5bFHwtxZMMOdowmUVGdozFLqM96xAnlkIXWMx6XY71P q0W2yFeBw4MsVyY5vKggC//seES0ntiWnGoRO7EkwhlnsldeBMzNk5fW75QX3HKgwNYo 7OeQ== 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=ZH9yvId2NMAw4oN1iqMKqU61/DZ/rIDZexlE6dKv8SU=; b=QpqNlYHmJP9+AUptGqkMk9Yr2tbs1Lu5Hbzn7GKewDKIGq5xU9FZIoCaMlhn5RZw8h ihTushcYMp9+T/hUAZ2Wu73FJjMNoQSFsL0kWjc2CEVX0C3hsM42/k/NAQvFFbSXjKAt anc3NKAR7e46i2FAe4GdlqanRux3ipYkwdEZeskUhqS0eH0nnW1pzzHL3zWIS+bttACk EYGv6nMZfG3lV8AhJQEN6V3blk3mFsKNQTzVDru2k35lx2Ey13Cp4PLGzOT/f2yJ7vdu sBFMQ7mN67mopcdRNu0Yc5VVc2c7fq+Qi7RmxZYq+nFlJavG04OECrMD2mBx4yUdpEt1 Q81g== X-Gm-Message-State: AOAM533W/mlB6BkWNLxGElAmzSugTSYWy1hZhTRRz0/yVzh1jcUmxpEl K95dBsm1YebjX0KuvBWlYY3IJg== X-Received: by 2002:a05:6512:22cb:b0:478:d66d:f750 with SMTP id g11-20020a05651222cb00b00478d66df750mr5768811lfu.291.1653910028823; Mon, 30 May 2022 04:27:08 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id a2-20020a19e302000000b0047255d211bfsm2253577lfh.238.2022.05.30.04.27.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 May 2022 04:27:08 -0700 (PDT) Message-ID: Date: Mon, 30 May 2022 14:27:07 +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 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: <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=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 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 --- 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