From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EB22C61DA3 for ; Tue, 21 Feb 2023 15:07:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 85AC56B0071; Tue, 21 Feb 2023 10:07:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 80AE56B0072; Tue, 21 Feb 2023 10:07:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F9386B0078; Tue, 21 Feb 2023 10:07:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 610C46B0071 for ; Tue, 21 Feb 2023 10:07:26 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2747E1C5127 for ; Tue, 21 Feb 2023 15:07:26 +0000 (UTC) X-FDA: 80491627692.06.4D2968A Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf24.hostedemail.com (Postfix) with ESMTP id 25C9418001F for ; Tue, 21 Feb 2023 15:07:23 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=iEs5G9H0; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf24.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676992044; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LuoQfbt2KTtRM14/DGy4Xw84gjAGRL7EtHDJyvKijkc=; b=lJN0r8FD6Y0tpmaa8nkstg9KpoRuScpSvuaE6kXXq1R5kX7zk+6tCKO6fzxfCVPpQYGAM2 PHD6q/HTdSmiUAn8n6tYM2edGJuLQv+DFzsYyVW7W1tQ9TdyCdE3TmME/0MpKSqtKf4rSV oS9VHMqSaCF/82HgvbOQ3RKYZGtcUHA= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=iEs5G9H0; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf24.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676992044; a=rsa-sha256; cv=none; b=fStk/Isi2Q+MJzMcLc1LEBlD+veDk9vn5xVC6LUuBb9sr3xnHh6jHJOfzE7h77CIKclQK+ nr/yjPcmhCslBqaDP+p8iUqH/TtUypgh3YBHAisVvjhBZGeEnzmsNyBIsy1rZOt7QcUABq ROAiEl/og1Or8QP4mmrTImdGacVxMSk= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D0CBF34BC2; Tue, 21 Feb 2023 15:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1676992042; 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=LuoQfbt2KTtRM14/DGy4Xw84gjAGRL7EtHDJyvKijkc=; b=iEs5G9H0uW0SncqaXgoZdfWT5Nfcp7Jr/y+R0YLekUASyEbj+x2ZJWa0x7T3+cTqzqm68a vjZkll0GSyPg7eRu6K3kjKzzR7q1W6ekeDrWrhAAWXYJoYEhC4aBeSt271xqMNzCFxvUTS tTs1+DB01YF+v0vtUlJ/Xhl9CgrQXNc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B193713223; Tue, 21 Feb 2023 15:07:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 34+2KCre9GM7aAAAMHmgww (envelope-from ); Tue, 21 Feb 2023 15:07:22 +0000 Date: Tue, 21 Feb 2023 16:07:22 +0100 From: Michal Hocko To: Matthew Chae Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Andrew Morton , kernel@axis.com, christopher.wong@axis.com, Muchun Song , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/memcontrol: add memory.peak in cgroup root Message-ID: References: <20230221143421.10385-1-matthew.chae@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230221143421.10385-1-matthew.chae@axis.com> X-Rspamd-Queue-Id: 25C9418001F X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: roytym6tqrb9zumijrf7631p1rqaz3ub X-HE-Tag: 1676992043-55395 X-HE-Meta: U2FsdGVkX18asI8PBTuuVSK3XWtgkPsrLeOcjVShLbxGcqqYtIxHFBzMkJ86LGrv+Op4H59mH2RockwFCcXcdQ1lILp/vfKhJjQE+jR7gMnqDfY1a9fnTQRY/fDUFG3lDJfDNWWH2MFvrFEWiQCTN40GRqWNIkTT9kYf8+4OiWp4hQeOgoakQM/fnJijKcCCKd0Kqd+vkWvigU0MNCX1lZHFQBQFOYFg6+NzTUOoMmO0zxechSwzIRx3YPO6kC0IwPY8HbticxJPIIXSugbuZHKdNowuYmglBWQ5mjr3Gy3aLaaMGKTJ5EjsOC7NE8lqFxaHzZC0TCt7LBSrc82vX4yjVgmqMH6s+FHucwZftfrwi1jJXs2xd/w6aDHveFMU5f7JgpZ4clgaQPBJtrspKCq2cw4r3ajJELiunbM/QOirCU669gqPryWrwrNr2X8PE5//7d9kJln1g2kuRMiV/A6iEXzl5UtAgTZIbxTY2qayMI/d98ht28WSIrzhmcRcAWYeHH3D7svxmWvPB7SFta96Bl2bdeDNuQfyTAsl+/41fRucuZWwIMdr8sIwLj38z+aPCPtCvWsVROk3DN1hNeUUPSojFZOxwzDv1/sMSAD7qoKdkJ4vjKytOAqAem1sqn8RxVc07mHvWSJ4lpLfaTG0sTW2u6RRZ3eWGz64W9eLZvDi8KORqPkeokusrfx3DnW9CM3NAreBfGmpUzwxn4MjFw5QGPNFELc64vzvBcPUfXC8vRoD/zipeA9WTK2kuxJ4JJmUgoh1wVTEsp8VDFfUkhc/by40w/yl16ssJleLYiA5WU22gDwHzr/hTR3aBv1s0+vOA45Miat7cErsZvDPSG/DNN+6pm/P0sRStJVhgTd84J6ysN7yBAAFsuFTeyqFReRicatqSWUAHt7SW3YZg/2x0eqHAeFB4MAi18iHaMoRVBZt7aB3KbUDtb1h9EDlBjEs1LfwLO2MxGV b6b9VNiE nNPLrnDpv8S/kv5cyV4AiiiBQz5UQ5N5arNzqnxQrCf/uBbcoTdKXuu+L6hT+XUpoyD8zWWSYqaRbkTATrrJsMqRt5Xuby2C1IUH8G972PGXUGVeQYWm8l7Hg0bQIPXM+HbKj X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 21-02-23 15:34:20, Matthew Chae wrote: > The kernel currently doesn't provide any method to show the overall > system's peak memory usage recorded. Instead, only each slice's peak > memory usage recorded except for cgroup root is shown through each > memory.peak. > > Each slice might consume their peak memory at different time. This is > stored at memory.peak in each own slice. The sum of every memory.peak > doesn't mean the total system's peak memory usage recorded. The sum at > certain point without having a peak memory usage in their slice can have > the largest value. > > time | slice1 | slice2 | sum > ======================================= > t1 | 50 | 200 | 250 > --------------------------------------- > t2 | 150 | 150 | 300 > --------------------------------------- > t3 | 180 | 20 | 200 > --------------------------------------- > t4 | 80 | 20 | 100 > > memory.peak value of slice1 is 180 and memory.peak value of slice2 is 200. > Only these information are provided through memory.peak value from each > slice without providing the overall system's peak memory usage. The total > sum of these two value is 380, but this doesn't represent the real peak > memory usage of the overall system. The peak value what we want to get is > shown in t2 as 300, which doesn't have any biggest number even in one > slice. Therefore the proper way to show the system's overall peak memory > usage recorded needs to be provided. The problem I can see is that the root's peak value doesn't really represent the system peak memory usage because it only reflects memcg accounted memory. So there is plenty of memory consumption which is not covered. On top of that a lot of memory contributed to the root memcg is not accounted at all (see try_charge and its callers) so the cumulative hierarchical value is incomplete and I believe misleading as well. -- Michal Hocko SUSE Labs