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 0614FC61DA3 for ; Fri, 24 Feb 2023 08:24:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40D736B0074; Fri, 24 Feb 2023 03:24:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BDCE6B0075; Fri, 24 Feb 2023 03:24:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 284286B0078; Fri, 24 Feb 2023 03:24:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 19E266B0074 for ; Fri, 24 Feb 2023 03:24:00 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D06391216C0 for ; Fri, 24 Feb 2023 08:23:59 +0000 (UTC) X-FDA: 80501497398.11.8910B86 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf01.hostedemail.com (Postfix) with ESMTP id 1184A40007 for ; Fri, 24 Feb 2023 08:23:56 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=mr3Ky5je; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf01.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=1677227037; 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=AL9X1+yNh4TnR5INv6zRDMmmyJRq44OTuNAoJX2NvEw=; b=DX+6rwA/v93J5v/s8+5Ri34VLuBvmtXKD43C7/80Jw5yg5GzEHvHLNry+naTH7fLY4BF1K J3lWkrhbLTBzVDOn91vYawu3DDrKGk7QXQfOsCCUxZZp0VG29E3GKznz4uQxxbVWjljA88 pK9TzavbRCriR7DcTjt6jlShnYUs2Ws= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=mr3Ky5je; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf01.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=1677227037; a=rsa-sha256; cv=none; b=EEVIeoymFmMpSHZqOuufMR62w4KSP/CCyR689kLVS/4j8vebpbB9U1W0xeOVF/tQ/I2jjr Hcoxm62l3O6JhN1S2rdsjmqySbOnjGPiLAQnPSfffxzYU/T+N4xxlUjuSOM7OK7e+MjYBu 2t5/Gs8cTgCDGo5TwGDMowWW6aM49Cg= 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 7861F37778; Fri, 24 Feb 2023 08:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1677227035; 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=AL9X1+yNh4TnR5INv6zRDMmmyJRq44OTuNAoJX2NvEw=; b=mr3Ky5jeFRjUgdY6dWt7rZesi83ypE+9L4yARacUWa/Kcq+CP9K7kdFUzIlaB3BC5pl3eX r/zrBqwCYEAHmsSa3pPf6706wmMpxxT6ptA0LDGOzH6P0TWwiZO34r/4Ia3wb8ngm5oQSw E/Ep32+6vsnuzjqeRYsGj2oEwkR8dsM= 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 595B013A3A; Fri, 24 Feb 2023 08:23:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iLnaEht0+GNYFwAAMHmgww (envelope-from ); Fri, 24 Feb 2023 08:23:55 +0000 Date: Fri, 24 Feb 2023 09:23:54 +0100 From: Michal Hocko To: Matthew Chae Cc: Roman Gushchin , Michal =?iso-8859-1?Q?Koutn=FD?= , Johannes Weiner , Shakeel Butt , Andrew Morton , kernel , Christopher Wong , 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: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1184A40007 X-Stat-Signature: xuj57zusq51yje19nifmbt4yquzor795 X-HE-Tag: 1677227036-814836 X-HE-Meta: U2FsdGVkX19wO4/UNp+msQf0BEHrapWGDcgz03AlddbBVFjZ57rnyFED4WqG3VabV56jw1AMje56E8DYl5hdz9yrvpKCOBKCOk9BI79Sr2MUbJy5uBFigtgVY+cO5T3BakxzskfqKjv0p0RKmdUjbJDgbGSAkKs+lotBpSU/QfeITOF6je5KHvqdDgkPVSeqKrob/qgSvhxdD2RLBccaxPH01XPUPpr66ZbUUOWfOp+WUF2TQlno9CrqnYFplID6qWqB1OWTzVZjG6FE4jg5YafpRik+rMSfAoocOrxWHMp7dUAxA1gow8+RhOO2Abc+Y4I+jxFGDIyyv9xdUMgkz5hiuA/Hgt4tRgZxrob8cCXcRTZWYORR9v6JVESYx33a9myI2pAi80UF17udhlZ54Gvvwcwhxv3XjyNg/ODc9Kz7ues/WzolGAxYBCwe3vFn+ArOVLe4ay7XAthlnQmysq39Gd0SGe2DnzZ8oB/2N4aopzT7WhH/5C3RCXXQWY+I7xyx1GjFwC4Pi8T+hNyLeNjE4o73QP6pFvRhYt1+UQXUntDKGT3fQW6KbJLpUJQOeJc/eNafARplgGnnhaMuAgzaNmKH+txFYwg72opkyf0/lFAiMIIwggHR+hA6PD9iV2xIuAcPm2Jh7ubdjpkJkuUminKjJwTqYg/z+SJGUCGKISXF2p1ShQ9PH/DP3x9hsc7UmZ1VhoL2cMCmABHRqF/KGi5SC7XohaJRnYLEg9rAshsOK6t6/ARmVEGIGDVMH/gg9yCNDxkjPti9tcM5n0L8fU7Qu8cTsFyfo+WnFcu+ExD8mkKXNVIw9g3HlfZlDiju+cAixr68QwpMCwXIKieNip5vl1DdQ4Ljv8RkKQWP2dI0v+wkZbeJXrpErdkcYv4m2NB22lO7dkXnum9ko8IyZSEUq4grezjubKT7t7O2zuEtG3V7bCaDF6wUe62toNGcbwoY3PHV6sp8kdU NrhpVjqp O/GTCYqWDfNLRcZmNYSHRyqpXDqxhEtlUncc4SuNQ2hFLaO6/KJz4MMRse4H4MYZde3X9bc2XnaelcMrkev8Pl2iL8QiLT6xtSVrUg7sI+SIcsDiSdpfAnVKvnx2B8HgyL8JwPYkWwroUjkdmu5dUefUagn6sY6M6HnuffMfzhRZhJ9Zm8pS9CAVbas/xANr+ZChDDwrkrxcyZSnML4V5yyzSug== 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 Thu 23-02-23 19:00:57, Matthew Chae wrote: > Hi Roman, > > I'd like to get the peak memory usage recorded overall time, rather than at a certain time. Sampling /proc/vmstat should have a minimal overhead and you will get not only a single value but also a break down to broad cathegory users (LRU, slab, page tables etc.). Unfortunatelly this doesn't cover all the users (e.g. direct users of the page allocator are not accounted to any specific counter) but it should give you a reasonable idea how is memory utilized. Specific metrics really depend on what you are interested in. Another approach that might give you a different angle to the memory consumption is to watch PSI metrics. This will not tell you the peak memory usage but it will give you an useful cost model for the memory usage. Being low on free memory itself is not a bad thing, i.e. you are paying for the amount of memory so it would be rather sub-optimal to not use it whole, right? If the memory can be reclaimed easily (e.g. by reclaiming idle caches) then the overhead of a high memory utilization should be reasonably low so the overal price of the reclaim is worth it. On the other hand an over utilized system with a working set size larger than the available memory would spend a lot of time reclaiming so the performance would drop down. All that being said the primary question is what is your usecase. -- Michal Hocko SUSE Labs