Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1123357rdb; Fri, 2 Feb 2024 14:47:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmdKDkJ3REgDG3vr2O4MpDEWSlLSiqIIZIth/ESi+pbcGN8tc6lrVCof7MbXs/maRlZmwA X-Received: by 2002:a92:ca8b:0:b0:363:b519:bfff with SMTP id t11-20020a92ca8b000000b00363b519bfffmr2743366ilo.20.1706914062578; Fri, 02 Feb 2024 14:47:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706914062; cv=pass; d=google.com; s=arc-20160816; b=ElvMbhmECqk5h5aXGjuI07ERJb6fBirLeThJOWoJ7XJ4IcOtAO1Vh8UBhXVeahK5M9 GBi6avMcrRhY4D0G/8gStddo9vsOcdEI5H+R8bFOdlNkTpqDz24oEwKOxmC6lX+lj95E nmbQAB1QOwPh/E5PryuqTpk7de9EUICFWbtWVbCVFBQLeyTMWqa8QyPNbezifji9TYjS v8g7iWwndZ+OzNi9j7lJE8S6H5oG9lvwzuWVEQnKT4i9C2l61TN8nnCMnY2B/lo5dL+0 TkIE0arj6/GhVquUK+p/Bp7JfvOoQLitQKUhY9xgttbVJqq4kHmzNzYPB3+taOEgYHnI aIjw== 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=bCfFQwrE4UL1PKl+LeclfJETuW45xBZgfwbXOew24q8=; fh=iteSNXqvAAd9jNjI8p9uNsVGHuieGiFJ7Z3BFUBp6QQ=; b=PqDVfAej9GejCeM6dLi3qN/LTuYVmvbvBOZY3uPfI5qzuMsSaTXDJftGyXrnrksTZB peOFs0YaAbs1SeK3fxDoo8k/02NzK44wk2d/8Ow90+/MBbTG4plGfbvKQzCEzY50DMOI D2zgbi7c9WIXJjWc3YD9/hlUtJY1yBn2D+7WYQT2GDQE8W9wwjFgwNQVSXSb7lOErBfZ ynATPSItXqrFYhbkdMi3PwNUQvX4SwCAUDHw1z+Z+ZM1sn7IXq59IGmOPAKd/52j3caR YjIYth/b/8TGv/Zj4QW/5ImanBVDVyCwyZ1zHkVWwEp6/qipDXE51hzV1/T1tvmah4Gq uaDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=o00Pc3vh; dkim=pass header.i=@suse.com header.s=susede1 header.b=LvzGCXdz; 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-50676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50676-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; AJvYcCW25GQ2dG3NtSLJzPWcDVT1V7O4kd+DLRYHq//1OxO8eBh6Cn7u57kUirU5DnDHSPc/JeZq9+CIa5QlhY7DfLZDHh7CPPwpmuXo8/L7Mg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h34-20020a635322000000b005ce05e5d57asi2224188pgb.660.2024.02.02.14.47.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 14:47:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=o00Pc3vh; dkim=pass header.i=@suse.com header.s=susede1 header.b=LvzGCXdz; 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-50676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50676-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 52DC128DC2E for ; Fri, 2 Feb 2024 22:39:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92CF885953; Fri, 2 Feb 2024 22:39:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="o00Pc3vh"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="LvzGCXdz" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 E9C3A85933; Fri, 2 Feb 2024 22:39:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706913578; cv=none; b=VJgPOowh6QO8vWmUsLrKEirbahd3K9pSWqvGueO5JKXBBik2nOWA1pDk9tfhXCiCw97EpRhyRIBA1f6TpxV657u1OAOYfSZHfTTXr50JqUkLYI/WLYmkkGfa2EPlzx0RVm/bqoHIgY/xyE2YrqxgKfpPtimKVSula4K/uLBhO1M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706913578; c=relaxed/simple; bh=bCfFQwrE4UL1PKl+LeclfJETuW45xBZgfwbXOew24q8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nMQM4UzZcIDug9KYaZGtb8/v5ml92l5WPgsAowbyzTAMQ2lSToiqBNTGwhxQqXm3c4x5DiRkF2CL4k0grqOWS0pqNZpx9mBJHPC7jGuSr/OO2K8uZ/qT/hOFpQ5pRKg3A7/yGhwQGbZAg/CyFrgElWuUxOki+U+usGLnuU8/H4E= 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=o00Pc3vh; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=LvzGCXdz; arc=none smtp.client-ip=195.135.223.131 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 imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E9BE31F7A1; Fri, 2 Feb 2024 22:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706913572; 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=bCfFQwrE4UL1PKl+LeclfJETuW45xBZgfwbXOew24q8=; b=o00Pc3vhT/8ojuKDWrSL4FR8mVTZgyFICtMOAhjKvC/laJcrnSTqF/WbWFfrUQdYM60ZA5 iCs0SjDYquSjs6tn55Gkrys8NF5yNZuxmq8wqLBuj/MI0VGGfBMIqEddWXffAV4Jg9QvRR CRAAEuDaj5XW016PgvnhSmuRcrIsfhk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706913571; 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=bCfFQwrE4UL1PKl+LeclfJETuW45xBZgfwbXOew24q8=; b=LvzGCXdznaw+pWLdKAHRAavGrwObeHlndQqMfus2+pnPxZPoYNDhF3c87fCd/xoisedgfh wHfQRTzglfyboLQHsqkZSje4OuPVvAEuJKGyUQbV4pAqHJ7zAUvNdOHmd2MV0DbrMpk4Xj Q8bqes4dlFs3/XNWDYSSILAbLslIXu0= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B62CA13A58; Fri, 2 Feb 2024 22:39:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Wz88KyNvvWUsEwAAD6G6ig (envelope-from ); Fri, 02 Feb 2024 22:39:31 +0000 Date: Fri, 2 Feb 2024 23:39:30 +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: 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: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Level: Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=LvzGCXdz X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-1.07 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; 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.10)[text/plain]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[12]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.06)[61.75%] X-Spam-Score: -1.07 X-Rspamd-Queue-Id: E9BE31F7A1 X-Spam-Flag: NO On Thu, Feb 01, 2024 at 01:02:04PM -0800, "T.J. Mercier" wrote: > It does blow up, but not how I was expecting. There's a null pointer > dereference inside find_css_set when trying to get a css pointer for > the memory controller, I think because the allocation in > cgroup_init_subsys is skipped: Thanks for trying! I suspected it won't be easy. At the same time I suspected there must be a hook for your purpose -- after looking at cpuset, I was reminded of cgroup_subsys.bind callback. What about triggering periodic flush in that callback? (memcg doesn't implement it yet but cgroup_init() takes it into account.) It would take any dwork activation out of mem_cgroup_css_online() and it seems cleaner. (Ideally, the flush could be disabled again when memcg root is unmounted again. (That's impossible and practically unused but that's why consider callback approach cleaner. Of course, your original guard serves the purpose too.)) Regards, Michal