Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp159943iog; Sun, 12 Jun 2022 22:46:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYDRA9B3iJvb1+jxlVaJjvzz1uxQs2Jy+UnCFcW9MQE75Qz08vsSv1CM1yGzixd3Kep5Ap X-Received: by 2002:a05:6a00:1956:b0:51c:3a0:49d2 with SMTP id s22-20020a056a00195600b0051c03a049d2mr43400969pfk.29.1655099188959; Sun, 12 Jun 2022 22:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655099188; cv=none; d=google.com; s=arc-20160816; b=KJy9Wdobccg1lJEu7L2NL5i+V6VVTNhz8e0zaFZKKMZWd0e8jlMESKzvr0YRqeWjQ8 L6zbNLSC/hJ79sOsQwObMXNUDpB0iSlC42hfttGyQH0RpDONJB5PzesYa3ecxMvbUHhu eLvnTDiFPxxvh8xxKUr+F4vuAOeO29lFC0SE2o0XK9Jielko0BMs9Sfnw5UoDMzRp1F5 n7YPlgdmMWfzjpBF8cZoDAnHbmOMXa7eVng6i72BGcIAkObV7l1VHBWrhrE/XJRkdsOZ 5XLJFpbGS3w6l05KYODCzinh/ivKuy0tP+ca1bm7+A4CRZ8mJC2m5t82mh2RqVEYs/nM LB+w== 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=zGBTHLv32bRuK6zx2kRrsaJzG8YfWC0waQXY/oW67hxGRKly9xznJJv6k8PmPrw28Q EO5SPRXTuv6sZ7QG2zACH//4zfjA9Lilqry9Ga6XaSoDGvkfSQFmWuaf3NJ1CemDZ+9R 0dEQ6teIeBpBQoGGDAM6vX6K5LlaCT7L0W2YnsApEUcKbYp3DoutZo8p5Kmvtld/RV7+ JnzWJLRFnkJpq+I+Oh+5yjmgGaYOXypR0Qv5xdm13PdIwAg4Yqthwy4edSOXbld/XU3K iqVxyPHfzTkPljjTDkUI87yLuF0rKA0iktaIUavvuaz38w5C5wtNpLlxZqNMfqTnTw1R aRDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=pOR7O1t5; 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 r29-20020a63441d000000b003fe0ab0238esi8945196pga.310.2022.06.12.22.46.16; Sun, 12 Jun 2022 22:46:28 -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=pOR7O1t5; 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 S234610AbiFMFgu (ORCPT + 99 others); Mon, 13 Jun 2022 01:36:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234620AbiFMFgY (ORCPT ); Mon, 13 Jun 2022 01:36:24 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6213E12AF0 for ; Sun, 12 Jun 2022 22:35:52 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 20so7108650lfz.8 for ; Sun, 12 Jun 2022 22:35:52 -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=pOR7O1t5o1xCznms3YZVoDk//h+f8/fV4zwbTF71juOxY1C62zNSCCgDsAvK4WX+hN wsAJDy6ZwBwLoUy5BIB1oRNm4wHPLlfZ8DY1WmWTBalya5YxORe+47B+QWkq1whgFSPE NALVRGhpOBGJ8npvVljSdkejj7UwD33OQ3IXaaMzsb2YhN9Vd+x0GS1QdHn11aYnQdbh j81zIPiB/Y6l0WXfdX+sWHlsuHGnoM1TO/QbZl7dZQxj68I7nAVGUydJvYKOvwTV3L55 15XFDDiDYb79xpH1rJssMF4rPQd99yM34z3FIvgplvSdziiZXPCcdj7IYtwxn7W+CSWX tHaw== 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=feEX6H0TLhFTk3zZH2UNIp6I4TOQt11asETzsitNetgwJdh24FZCK1EDvyNHCR6QTK 7e23HUvlqqckF6D7ZWxGXVWwU/8V7gMr3TdvQXHDlnggjruaKMeKiAXFRGiJhIwUXVkQ Zz3sboWgc0rOwp4IUb4ZGDhZhj7DhpdTKow3imEOSRg1mAKKAl4y8pmAeaKADC0OMNjU iwR2Wr8rRFEaV32bxRi5OeC8R526xA1RfPqTqmUXCloxAKkF+LB3nSNyGvcPbOKJitGQ N6BCRtFcBWmHISMG+lm98R1vFNLv6C3t9GjjVb5RDeU+h4OmmPKBjWmZ0crE6+YqM+PG SU8Q== X-Gm-Message-State: AOAM531CowLEFFK8q5ay2SCgsBqaBr6Q98NFs2JLacnBXPaUJ/uAuII7 DWLZoNE7KJY39jWmTdqS4cKRjw== X-Received: by 2002:a05:6512:3dab:b0:479:56a9:d513 with SMTP id k43-20020a0565123dab00b0047956a9d513mr20487427lfv.531.1655098551395; Sun, 12 Jun 2022 22:35:51 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id m14-20020a056512358e00b00478ed80852dsm847592lfr.58.2022.06.12.22.35.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jun 2022 22:35:51 -0700 (PDT) Message-ID: Date: Mon, 13 Jun 2022 08:35:50 +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 v4 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: <3e1d6eab-57c7-ba3d-67e1-c45aa0dfa2ab@openvz.org> Content-Language: en-US In-Reply-To: <3e1d6eab-57c7-ba3d-67e1-c45aa0dfa2ab@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