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 72B24C3DA49 for ; Fri, 26 Jul 2024 17:30:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04BCC6B008C; Fri, 26 Jul 2024 13:30:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3DB16B0092; Fri, 26 Jul 2024 13:30:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E04DB6B0093; Fri, 26 Jul 2024 13:30:43 -0400 (EDT) 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 C0FC06B008C for ; Fri, 26 Jul 2024 13:30:43 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7C7DA1619AF for ; Fri, 26 Jul 2024 17:30:43 +0000 (UTC) X-FDA: 82382593566.29.8A52FA7 Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) by imf15.hostedemail.com (Postfix) with ESMTP id 9BC9FA0031 for ; Fri, 26 Jul 2024 17:30:41 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=WRyB7Hou; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf15.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.187 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722015004; a=rsa-sha256; cv=none; b=cRN6DkX1EuIFn2/BqKqf5Thw26WGqK6Yy4bBxnJs8ZE1cRmwq6E0fXjUVAyJmrz9BtuG6T giHnMnrjE4t+/uN4yu2DydtdZGBY7iXUgxiE0LPjH5fb1jzSGWOy69jm6VbUrtt7J7OGYV 07tJAufW94UKSc3iMNYAGzv00aA6Qsk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=WRyB7Hou; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf15.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.187 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722015004; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=q/whrTc8Vg6KsFi8iJ+kBMuu41SrRr3us36dwb/hbYY=; b=tymTTzu+uIeHDmqP/bkn+pZkH3L65BDxogwFUGZDTYpb4lgwyBphqFEZ1TsFgN9rFc2anN 4f2iONQzcJaUh/j1ojU46DvP1EB9a5cqcJ4cYNBItopDVlt4Tn6NT8FdxISeiJlRXNc0vU bjRbGpyNL3JtHBW/UVhO8p4iCJZ+PNs= Date: Fri, 26 Jul 2024 10:30:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1722015039; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q/whrTc8Vg6KsFi8iJ+kBMuu41SrRr3us36dwb/hbYY=; b=WRyB7HouuQRI7axifysvz57Xzls6I5KgVhHHPuNkgSRrvhuloHKdI4jWGjbcHSTSbn7EsT Ov2XLxeQcuJO+xIUWCJlO796mu/n2hh9CGqS28EOarTrM3OLjEFMVrSHbTMpIygfTdOyGY syvW8IMO+O/Ofdl6ccInR0v+duB/As4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Yosry Ahmed Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Greg Thelen , Facebook Kernel Team , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] memcg: expose children memory usage for root Message-ID: References: <20240722225306.1494878-1-shakeel.butt@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 9BC9FA0031 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mh8d46fjrrgumciqx7g8fa8o6yyo6zny X-HE-Tag: 1722015041-773898 X-HE-Meta: U2FsdGVkX1+cIC/Jp1DczZe/u5ub0bicwx0+zZB5XPVxZBEfNIxiZwlCIfMxodCQbSnRXi6gl//hJ4767Qx2OaBG9u/ADy0vB0ZWYzH8175oGHMLhzhb0+mFJC1oIja6WPL/RkTbN2IFGvy/pqIZ3E0IBNPjcKhiin8DXTDSvHvORuZfUV3jrZSX6a8fo5b7xc86+aw9CwJRWKzAui/cR0iF0y2De4gk1M0iMPVsOrW4v/q/0oATiAlEJew+hDoY00AIXs1klXjc/0QX4jmn/W+baSuOPYLJUx0wSHNFrJPSWgJhUd+b4ztRV9ulv6PMK6ULYWVVmbYTdts+2lGujjEhIqFFCSHOLjoZrdRE138CNI7u6ESbEGVIfLKDsT5HwmOmJ0kK3WXnyveAzJo56KKfYq3gxH9F/E97jOTMR4KjQtDHXT2tU1/6YWPvadqcZLX+zTE9YdqwPy65a9WRJqQC+P5mwcr1yr98KX3O+TWnMd15ECEw4n7C9uTIlIGnaB9UxljwMbw7PA8URwQaWg9Win5Ii8qEmbgkg/kVBx0g7P80lbxGkEPH2Yn+S5XMAwM5dD8WGTiKoSxncPCmndMleH/KDKixEoT98BMvYn7j62OvzpR6FPMaNiJfjZ34qNT1ed0LPbKxZhuKyrbPAzlIJ6+JtllwfCwukuFTQbfewQCGjMR9Kh7rms50uaLLc+RiKDJj9InqsKNc76u7Wurvw+qR5mB0GGxmV4wGIoRqEg38CCEa1AybtbLxLCelop1OQGCdElP84ffvsb2QMs5YrDMIxa3ryrCzFWYQRhfZRJRmtpZWwalUytPIA+/WrDaeE9qYI1sDFwT06m3uMVZ2qulyHoFHTK9KqT7aHoyguuHARV8faGXcHZz36Ze0pRDT4Tr63/CFTTZdtZCd5wK7PiFKCv0d+A0lirT1gYnyfUtDBpxWdOzP2X3OAOB0JosroTib6n3k5zDf3t6 YkHFW3HB 0rdZbkAEMxak43HiFUioPGvvIvquy5spgGAdHk7EgkHG9BeVDwrUyz2f+LXxoO+qI+TAWEwxRSLORYWx7AN7ogH5CUYzQF2TBVsF8kAw9wTtYP3hxO8diOWHMudoKglRL1eYH4ht8vef12W8b1F0rW2FK1w== 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: List-Subscribe: List-Unsubscribe: On Fri, Jul 26, 2024 at 09:25:27AM GMT, Yosry Ahmed wrote: > On Fri, Jul 26, 2024 at 8:48 AM Shakeel Butt wrote: > > [...] > > > > No, the workloads running in non-root memcgs will not see any > > difference. Only the workloads running in root will see charging > > overhead. > > Oh yeah we already charge the root's page counters hierarchically in > the upstream kernel, we just do not charge them if the origin of the > charge is the root itself. > > We also have workloads that iterate top-level memcgs to calculate the > total charged memory, so memory.children_usage for the root memcg > would help. > > As for memory.current, do you have any data about how much memory is > charged to the root itself? We think of the memory charged to the root > as system overhead, while the memory charged to top-level memcgs > isn't. > > So basically total_memory - root::memory.children_usage would be a > fast way to get a rough estimation of system overhead. The same would > not apply for total_memory - root::memory.current if I understand > correctly. Please note that root::memory.children_usage will have top level zombies included as well (at least until lru reparenting is not done). So, for your example it would provide good estimation of top level zombie memory through root::memory.children_usage - top_level(alive)::memory.current.