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 92223C3DA49 for ; Tue, 16 Jul 2024 17:01:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24E5D6B0082; Tue, 16 Jul 2024 13:01:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FE936B0088; Tue, 16 Jul 2024 13:01:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ECB56B0089; Tue, 16 Jul 2024 13:01:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E70656B0082 for ; Tue, 16 Jul 2024 13:01:27 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 77287812F2 for ; Tue, 16 Jul 2024 17:01:27 +0000 (UTC) X-FDA: 82346231814.12.54A41F2 Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) by imf14.hostedemail.com (Postfix) with ESMTP id 9368010002E for ; Tue, 16 Jul 2024 17:01:24 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=R462tVje; spf=pass (imf14.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.176 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721149245; 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=P+iafsuuzbArPekZqOmrPqo2BPh9YPyJZoOs5qGZ3sE=; b=173ILq0vsRlKuoz8qYng8wWfXtkF+di8GhgEWKYzQnGY8d9gw4o5qrZJ78NbckL7qExgMC Fc9anNDT1lGTRIpFaoNBVlQeTWd1Qpr9a0M3Rl5kjNT4ZgjDrZ7DRAwcaAwoGCjFfK0vVq ObMjqBfvhavpCMw5+TRSvkcii4x1hu0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721149245; a=rsa-sha256; cv=none; b=jFqDSyr51ml1T2/lirzIckvxO+HydFjTFhBaev2Yl8z6mToIIBmx9tg4pXNH9etuBrrTkn AAftpGIETmlwjK4VwpfW0TfIH2GMKDuYIld0COa9BoPrjCw0c3UASYRbSB/BVYv8yvTrM9 aqiHeHk3ilciMt+Sldm16Min09ezqWc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=R462tVje; spf=pass (imf14.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.176 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Envelope-To: tj@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1721149281; 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: in-reply-to:in-reply-to:references:references; bh=P+iafsuuzbArPekZqOmrPqo2BPh9YPyJZoOs5qGZ3sE=; b=R462tVjetdP9ddVUy8veVB1JfcQxuEvR1SZrFmrNDDojNeR9L+JqyBSVtSZjyCHcwAfpX0 e8UHz0sGXsYFh7wlvFIRd+3YCJbMsgKYCk8282VKnpfHLoHEUyYhImUCVwaFCjO1z3eiEG cHBGnDVmc9Z/ELPYWvzDttRssutFvFk= X-Envelope-To: mhocko@suse.com X-Envelope-To: davidf@vimeo.com X-Envelope-To: muchun.song@linux.dev X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: core-services@vimeo.com X-Envelope-To: corbet@lwn.net X-Envelope-To: shakeelb@google.com X-Envelope-To: shuah@kernel.org X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: lizefan.x@bytedance.com X-Envelope-To: cgroups@vger.kernel.org X-Envelope-To: linux-doc@vger.kernel.org X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kselftest@vger.kernel.org Date: Tue, 16 Jul 2024 17:01:15 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Tejun Heo Cc: Michal Hocko , David Finkel , Muchun Song , Andrew Morton , core-services@vimeo.com, Jonathan Corbet , Shakeel Butt , Shuah Khan , Johannes Weiner , Zefan Li , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers Message-ID: References: <20240715203625.1462309-1-davidf@vimeo.com> <20240715203625.1462309-2-davidf@vimeo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Stat-Signature: fxzn1m1nrk1x547zy6k91kkd7xs3khwx X-Rspamd-Queue-Id: 9368010002E X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1721149284-184581 X-HE-Meta: U2FsdGVkX194HW3zZCR6YVV243tLKvr1rz9dridSUrh1my7H3edINpgb7/t3BWbLOpH5/wEZ37KVdBQrILxlyAdNmdUFBmBmnCvf6cvAtAxxkq4qTy6Wut49J5IQnvhhw/z3xDl3xMjOmUZYeeSWdy7XSGgoUd/zRKM2sfRDwwMVy4oMtPvx2B3DhKSg7uSqf+dRWcqwymBMtLKXdv5NOM2/obkXh8YWOGNWOqqyoAsRbLU2vzq5WiISoNocyfRYOuw/EvntTmowZ6iYtiY2ViP8Xt+L4SDRnqz5h1LPB3B0hnkh/G3UKvMUtM9YBY2r0xMaQywQH6RGFadUZsEnv3T0yfmIkfUHe9x69vQkHt/0J66uCSyAaL2N+NM2i920X7X6NcxP80AwMoUOboS+e8NR/UnCvrMpWp/0Eft4Q/GOyyy1ucx7U2BZYbFP9wCGPcEWTnZt7yYyNWeHBVE8oRoNcvOo2Z3xNestRcBVq1uK+fmENnhrr5oCeCPpZ3IL3Wh5I/F39tQM00Q2SQ4kKPkT51Fy3K+nGTTXOs79BpVZJE7Zg/LZ4P06oEC8bJgCNdhLABbDe/RHln+4PyifMJHfWFKO2VZjRMfNsOJ8iUdMrIEGgxD6j1nUk338nMMArMGrQUw1JQO2bOrwTAhzVZDYSTEDg0BKmPeLCQngdR870Ris/PWx/OFwODwl+eKRr70K+eoevWXx8KVw/s0yZSDQidHmwYKwWraycw9dbmPSpx5inIWITSKx4EgEceTDrpR5BzSeXHZxNftKpz6hkaU+9m04RrUHY6higFmUFWr5DRrN7shI3E2GfSgItKIkSiUzwZN3+FZKsXd1mFKGgW0GOHvZaRRQwio22Z1rAZgVoSDcFIPlCESXg1oMa+Z8fOpMyyY/4Bl9lXxB0xyJHZbXeP/kNo3jj/fipwXvlVoEhAwC2/ibEZKg9LmmQPQGwQ8CMYFUHfzR6aCvkeX r6j+bUZH Qt417uMWA7l3G4pMr5VpSkFvVUfF5B+0iaMDsfLdyI9jv2vfwmk5PAgnYqiX+pB3w+OP4tq8s1uw+lbS0oIREEUJr5N8qra2J9xmlIkY1vymiI1OB9jevBWshsJQOSA1SeFWCuXYvKyN2cpOErlWlZ45Z/XQLvWD+aFbx 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 Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > Hello, > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > ... > > The removal of resets was intentional. The problem was that it wasn't clear > who owned those counters and there's no way of telling who reset what when. > It was easy to accidentally end up with multiple entities that think they > can get timed measurement by resetting. > > So, in general, I don't think this is a great idea. There are shortcomings > to how memory.peak behaves in that its meaningfulness quickly declines over > time. This is expected and the rationale behind adding memory.peak, IIRC, > was that it was difficult to tell the memory usage of a short-lived cgroup. > > If we want to allow peak measurement of time periods, I wonder whether we > could do something similar to pressure triggers - ie. let users register > watchers so that each user can define their own watch periods. This is more > involved but more useful and less error-inducing than adding reset to a > single counter. It's definitely a better user interface and I totally agree with you regarding the shortcomings of the proposed interface with a global reset. But if you let users to register a (potentially large) number of watchers, it might be quite bad for the overall performance, isn't it? To mitigate it, we'll need to reduce the accuracy of peak values. And then the question is why not just poll it periodically from userspace?