Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp221510rdb; Thu, 1 Feb 2024 06:53:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfpnEyYPQT9K5WsQbzcJpcXgdq9GisiPoIydEH7zGZ8sttGx9/Cb5MjNIUkv2jwI9smA79 X-Received: by 2002:a05:6871:a10f:b0:218:551e:6012 with SMTP id vs15-20020a056871a10f00b00218551e6012mr5774504oab.16.1706799197771; Thu, 01 Feb 2024 06:53:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706799197; cv=pass; d=google.com; s=arc-20160816; b=CH3HhvV8nfKEHocceHg6Px9pK5/4R8FVwUdu9Y6h4ca2sad1mhrQ9lA9kDz34UB3ix 1+tmuXT/Hr0G9LWQYNA8lbpZAgTW9HK5ZeNXsJfqnHLWIqKAyMaoIo5ebqIswu9Zx+Y3 hG6oMlTCxBAQukbNg87gG9QNHgD3OFOuNqtpdQEqDlxxQejPhK49UxsBlnkU2uESj4Lj hxL/6kRdSanOy4T2YFYmuP0Pbie709SYWEd+9Yr+JIYEL9ZHSOyloyfMBEmw818U/O5d Rr6cskDhnrn/WoR43ozX3vfA85Upbk2z9Dxy0JxRg2KGJ7Wveu/InJRW3WFnSE8nySUZ MzzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=jACJ8DHpCku0mqvIQWcAOIXi+dC3Hwufj+6uYVkQ35M=; fh=PsFYQF789jwSUfogWmPmbrUYSM4/TnFkam7lebDPgXU=; b=cnrGYkcPd6kdnTAaAtK1HPljyHToEY7E9qQiY7n3xnIRmL2N65nJEEDypcZF3PPi6W L3ML8ar1FgebKVZzO67vGhE6GHrl/5hrfz/7W8lJhLJkiZVoiJpFpW/05V1tid/bD7zX 6xDD+lJqPtsrwR56ilmYAE/K3Ct1APREudVCB1UlN060i++CM8XP0FIQdGK7OO1qg6zR mGExiT4t7YtDHYgXYVp8cwlXjgp3J250ZysX8+iAhytyyrShNkqbb4k4E/uZpxsoDAzO 1x5LeMhcvJNuxsjBAuK0uTGdDTWfXavsHkAzpy4dO6G6NXf0JfZcEAEDs7WaSOH61JzW C+yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=BZE8WImv; dkim=pass header.i=@suse.com header.s=susede1 header.b=BZE8WImv; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-48320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48320-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com X-Forwarded-Encrypted: i=1; AJvYcCW/ddhZj/nyRSdRZJ32m3pVBqibcwdGb8mo32dSYwoXJeTYPd7gDurtUBlrFIZnayT8+14JfROXu2BP3g9j5dNPHJ4SZ+2ibzJaavnHdQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p24-20020a639518000000b005d5edfb42a0si11918797pgd.843.2024.02.01.06.53.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 06:53:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=BZE8WImv; dkim=pass header.i=@suse.com header.s=susede1 header.b=BZE8WImv; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-48320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48320-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EDEA6B2BBB5 for ; Thu, 1 Feb 2024 14:26:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F5F55F471; Thu, 1 Feb 2024 14:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="BZE8WImv"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="BZE8WImv" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F3405D480; Thu, 1 Feb 2024 14:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706797577; cv=none; b=FkxGFciU0GNY1Mb/dK0iren7cM3dqcDrtul9hsXtfx/94nnBCYrRThm08VZrtBwHROqh/N8SZMJbTMnZN/7WIp5WPFFKnwMje8ew0fxD50XpaCzmMLb2OOqxiu+Azk88ymsshD30G80CGUoOst9/KMiImkLiU9eSB0ghrV/U6Tc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706797577; c=relaxed/simple; bh=M1DtNkvYenLawxtAmGCAN8VzLDHXlKpepP9pC/hiZto=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kuk9thVkN6+FI7h5NvLwBZUd5s64jTadSds0LSbVOrYxnQwZPMETg+MmRbt01DNTY4sAjTgF5KSvQ7U0KV/efSQSm3ffHLCKnirmaBiaO6fr+K0RAJCCpNiOPnVNaPyWluzXQpZMu+vsn0HsqRPQmS9Qh0ay8r3uXvJvZA0hnX8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=BZE8WImv; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=BZE8WImv; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from blackpad (unknown [10.100.12.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 947D922104; Thu, 1 Feb 2024 14:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706797573; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jACJ8DHpCku0mqvIQWcAOIXi+dC3Hwufj+6uYVkQ35M=; b=BZE8WImvnWarQOZqnaPgDyZG4Wr3WEl9ZmKx7bGI35vk6cBK74br0DE4nEdR6+0Vns1qq5 Zn3HNoP60dzOmhlc27B6C+e55ywxp/Riiw9E87gelyMpltob2SuyAjmRumEeBii1Use0He IhTnplmtKdtuquFdwhOx0ABWij61a5o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706797573; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jACJ8DHpCku0mqvIQWcAOIXi+dC3Hwufj+6uYVkQ35M=; b=BZE8WImvnWarQOZqnaPgDyZG4Wr3WEl9ZmKx7bGI35vk6cBK74br0DE4nEdR6+0Vns1qq5 Zn3HNoP60dzOmhlc27B6C+e55ywxp/Riiw9E87gelyMpltob2SuyAjmRumEeBii1Use0He IhTnplmtKdtuquFdwhOx0ABWij61a5o= Date: Thu, 1 Feb 2024 15:26:12 +0100 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: "T.J. Mercier" Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , android-mm@google.com, Minchan Kim , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: memcg: Don't periodically flush stats when memcg is disabled Message-ID: References: <20240126211927.1171338-1-tjmercier@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wxxx3wtjfattjixo" Content-Disposition: inline In-Reply-To: <20240126211927.1171338-1-tjmercier@google.com> Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -2.88 X-Spamd-Result: default: False [-2.88 / 50.00]; ARC_NA(0.00)[]; BAYES_SPAM(0.02)[50.34%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_TWELVE(0.00)[12]; SIGNED_PGP(-2.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[] X-Spam-Flag: NO --wxxx3wtjfattjixo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jan 26, 2024 at 09:19:25PM +0000, "T.J. Mercier" wrote: > The root memcg is onlined even when memcg is disabled. When it's onlined > a 2 second periodic stat flush is started, but no stat flushing is > required when memcg is disabled because there can be no child memcgs. > Most calls to flush memcg stats are avoided when memcg is disabled as a > result of the mem_cgroup_disabled check added in 7d7ef0a4686a > ("mm: memcg: restore subtree stats flushing"), but the periodic flushing > started in mem_cgroup_css_online is not. Skip it. Have you tried --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6099,6 +6099,9 @@ int __init cgroup_init(void) cgroup_unlock(); for_each_subsys(ss, ssid) { + if (!cgroup_ssid_enabled(ssid)) + continue; + if (ss->early_init) { struct cgroup_subsys_state *css = init_css_set.subsys[ss->id]; @@ -6118,9 +6121,6 @@ int __init cgroup_init(void) * disabled flag and cftype registration needs kmalloc, * both of which aren't available during early_init. */ - if (!cgroup_ssid_enabled(ssid)) - continue; - if (cgroup1_ssid_disabled(ssid)) pr_info("Disabling %s control group subsystem in v1 mounts\n", ss->legacy_name); ? I'm asking about a try because I'm not sure whether this does not blow up due to something missing. But I think disabled controllers would not need to be (root-)onlined at all. Thanks, Michal --wxxx3wtjfattjixo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQpEWyjXuwGT2dDBqAGvrMr/1gcjgUCZbuqAgAKCRAGvrMr/1gc jrpxAQDyZRXNtpLF1OlwunwH7s4cGq9S3p4xavcyCbU73SNKTAEA8OT63KKFtzzZ uYtGruEFhY4GBP430nCIMahipGl+WAc= =gZrw -----END PGP SIGNATURE----- --wxxx3wtjfattjixo--