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 AA66DC3DA59 for ; Tue, 16 Jul 2024 22:06:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21AC26B0088; Tue, 16 Jul 2024 18:06:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A2CC6B0089; Tue, 16 Jul 2024 18:06:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 042EE6B008A; Tue, 16 Jul 2024 18:06:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DCD6C6B0088 for ; Tue, 16 Jul 2024 18:06:31 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7BE021206B8 for ; Tue, 16 Jul 2024 22:06:31 +0000 (UTC) X-FDA: 82347000582.13.3CEC398 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf21.hostedemail.com (Postfix) with ESMTP id AEC5B1C0022 for ; Tue, 16 Jul 2024 22:06:29 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=vimeo.com header.s=google header.b=JozDeJeb; spf=pass (imf21.hostedemail.com: domain of davidf@vimeo.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=davidf@vimeo.com; dmarc=pass (policy=reject) header.from=vimeo.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721167570; 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=w2aJTmvDOMvn6K+ayRVj7cPeNTzCuJAPOw72W6PM9lM=; b=df0EqpcGGK1qTptW4tTBKf/gxXOZN5xCME2Y4WqZ7PKyDPi4kkmxMmy7f9E/dVf+HtXTpj HRrHSGxe0cJZoSSfQemStBo0kmY+GnSanc+c/mzmvvgmHGKTFfQDjo3vHv7l5MfR7KhLo+ nyGBANf5VJeIZUxs3AXSefrMTGY0E8c= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=vimeo.com header.s=google header.b=JozDeJeb; spf=pass (imf21.hostedemail.com: domain of davidf@vimeo.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=davidf@vimeo.com; dmarc=pass (policy=reject) header.from=vimeo.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721167570; a=rsa-sha256; cv=none; b=xKksHltg0luMx4n8GrMhsT6XJ3NhbVwi1L2tdJxNxmYd31ofk/3R3TAUqKX9UwnFXQSpz4 RV/ZSh1KLr2V77+5aqk3bJTL4cyjzCzv9P/vqS8Tk9H2p/+mV4w+s2CyRv/WzBmdhLYr4f R8PT88UuFSz14hnyugVvD0oOxeEx20E= Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-70b0bc1ef81so4069762b3a.1 for ; Tue, 16 Jul 2024 15:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vimeo.com; s=google; t=1721167588; x=1721772388; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=w2aJTmvDOMvn6K+ayRVj7cPeNTzCuJAPOw72W6PM9lM=; b=JozDeJebzCKXRlgDPy0y/zNYsXPx/kOm16bMmw/pmARKMWs/NWsIx4fnlLaDp/e4Nz +y8g+1pNmRck7Dtl/THHkvVd7F1fEAX4abPbu5/EySZleGCJ1+GxRZYD40qDDEQHAej7 H0+kjjR7wiaR4BvySulLIibhgrmqtqDK7xSjc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721167588; x=1721772388; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w2aJTmvDOMvn6K+ayRVj7cPeNTzCuJAPOw72W6PM9lM=; b=SHJfyTqZ7LV79GaacL6xoShOi1qXBncb09/bcZGZ1KVsKkdlrSsa5UpCuBwsZyi71L 549czmxUI0Yqx+qQ7WvySxDZ6+3hb23B8ABSWLZ7fSAhmwY6WP+LVx6vFDbuRBUJ8dar emjHmm5i0oNyFggijH1q43K5BW0NFUHZ+7atsoIcXxH4KDurMSTKALVlC5pffibzVteT 13FqQOnvjKZDzKqCUKefBwpvKhYHHTPDv43FasBiyUuJ1XyoAmKSpEDoK3RgEStcOFDr UjDNNbgfY9phJNOptvjNtEN2Pv/KH5Eh38zmvFdc96ZIsqvwtICeRw8Th4GqhQwgP7w7 dgiQ== X-Forwarded-Encrypted: i=1; AJvYcCWaOxPjv/JYOfFvrumI6fQIx+3dfLsstcfSrnwMQELPHgxaaCvNqT45XJgtSKhqO8QehB93zYp2rfIl5szlIQcQ1E4= X-Gm-Message-State: AOJu0YwSLRjpzOvXquANWPnGBeqQzKqILjwtinquSNThAIrbL7BHu3rO gPvsHwjcduekyAAG594xzpu17p/bP5U7t0/a45eSEYDLxT5/Y9Uu/ma0cEOYMXII4Ghq90roK8L Baq6r2G8gdCmVeyTmzDPtVI0ct47PxunbXgZ2Oj9+FIlo4mCWNtA/cQ== X-Google-Smtp-Source: AGHT+IHa4OUEBjwkyORdqOTlwB6SwJ3UGLm7iossoLCCGBgQW/WBnp341S1YhpWMm7wMFcfIxWpuIGR1HiBOvvInuxU= X-Received: by 2002:a05:6a20:a123:b0:1c0:7ec3:c7ae with SMTP id adf61e73a8af0-1c3f12ac92dmr4304824637.47.1721167588247; Tue, 16 Jul 2024 15:06:28 -0700 (PDT) MIME-Version: 1.0 References: <20240715203625.1462309-1-davidf@vimeo.com> <20240715203625.1462309-2-davidf@vimeo.com> In-Reply-To: From: David Finkel Date: Tue, 16 Jul 2024 18:06:17 -0400 Message-ID: Subject: Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers To: Tejun Heo Cc: Michal Hocko , Muchun Song , Andrew Morton , core-services@vimeo.com, Jonathan Corbet , Roman Gushchin , Shuah Khan , Johannes Weiner , Zefan Li , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Shakeel Butt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: AEC5B1C0022 X-Stat-Signature: s8xcz8tkh7aamy19ngayc7ttzhgjd4a7 X-HE-Tag: 1721167589-98859 X-HE-Meta: U2FsdGVkX1+s/oJ/GiYiVVT22OkPCFrADPstfhoep0jvzCywEMxWZVWGxZmrLJAx5YLOiAkNqmClkFxuak+f1MrVXEzdOceZvxd9n1eF14u7RIo9dri2LYXvDN6Y0Q5Mj+wGgqAUsrjptVihCkCAAl4aEC31sMU/C2hBg94fvN9x4W7mk2GASPGq7dynYt7kDyHNbOzRcIIX8IDWPyRjlrkg0Za6oXdK+FJ/40KE57AWkqsqxeMmaes3RPT7kK081v8GpytzUIQQnS9ETou+WhjI9VaaxpSKkGnd4gNPAVi/HwOjzFQPHUM/Ht4vyhShCTCZMnxaV6C1vFHN8Tmrz2tsiR52x8wbpCpSNajADVfTrYwgN940kd0LqbXU4Ltpfhk4QmKug/vcxV19npXooy2Kq4XKcx67dmIj4FUwxN0lJIBC5Edq2HXvLSBWgdsbcKwdQr9hcCBOJgIZ22JJenQ40TXdVEIGNRfUtkmQdwJfTygEyF40FNeBwpTxQRw7AgaGc+/T1Irx0GDVRYvLgnsR3JNk2E/pac+x0wDQVLJPXuK0GNtJxqir6YFN8V+xUHrS8IPy8mteGkgkvmoZqs+SCEe90YWJCMIZu5Ewy/uP1B4O4GXhxOBrvTGuPWA71fRo3/aPaHClsuJBYDPHC2kubwlwtQCxkH1bUxNyQQ/HOttWvWXGPmoqLnnQAqMMwa43hbuOL6HW5cpV+M22UA/kYEyNJDtLeLyoP69wVbIHhdtUQwpFKtWS56zB1Rt9XSPTeU3KHL0ztPHB7SRKJOLRSjCztGaGzMYKLduR82OJ+tWT5gG0hsvofEtlT0j9HQr7AGlplsvXAdYcdsbOJ26WzM2/dlKJGP5QaWzf1ySikByFPt1vrH9Zzq1awb7R96mAF3YaZou+1YPqeNkMLsdnYpwjF7/GtUfzjWQA/zefUcyZPL1b7PNHE+WIzU7R7KWfalKWVCy95nIoT/6 DyOyN0IB m9/Rfn3RWrcytKzTuzNKIxByqtbiELO1ul6hEOuC7mD3kf4QavN7MbHO2+GKf7nImdEo/FbjCeDWhiw5OD22bHoovh0xdfKRzH7JjFsxhfyujWKn3h68rbNIvtGUGRn3eTXXj0sMmmPmloOzOe+SsJaRsa1cdF7zObDfcBhcb7LAjWBD19uHnTxnY/A2+4fmFkocJlfO9DMYkX7+k8/uXXAXmXKpbAsRwl81x 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 4:00=E2=80=AFPM Tejun Heo wrote: > > Hello, > > On Tue, Jul 16, 2024 at 08:00:52PM +0200, Michal Hocko wrote: > ... > > > If we want to allow peak measurement of time periods, I wonder whethe= r we > > > could do something similar to pressure triggers - ie. let users regis= ter > > > watchers so that each user can define their own watch periods. This i= s more > > > involved but more useful and less error-inducing than adding reset to= a > > > single counter. > > > > I would rather not get back to that unless we have many more users that > > really need that. Absolute value of the memory consumption is a long > > living concept that doesn't make much sense most of the time. People > > just tend to still use it because it is much simpler to compare two dif= ferent > > values rather than something as dynamic as PSI similar metrics. > > The initial justification for adding memory.peak was that it's mostly to > monitor short lived cgroups. Adding reset would make it used more widely, > which isn't necessarily a bad thing and people most likely will find ways= to > use it creatively. I'm mostly worried that that's going to create a mess > down the road. Yeah, so, it's not widely useful now but adding reset make= s > it more useful and in a way which can potentially paint us into a corner. This is a pretty low-overhead feature as-is, but we can reduce it further b= y changing it so instead of resetting the watermark on any non-empty string, we reset only on one particular string. I'm thinking of something like "global_reset\n", so if we do something like= the PSI interface later, users can write "fd_local_reset\n", and get that nicer behavior. This also has the benefit of allowing "echo global_reset > /sys/fs/cgroup/.../memory.peak" to do the right thing. (better names welcome) > > But then again, maybe this is really niche, future usages will still rema= in > very restricted, and adding something more akin to PSI triggers is way > over-engineering it. Yeah, I think this is niche enough that it isn't worth over-engineering. There is some value to keeping broad compatibility for things moving from cgroups v1, too. > > Thanks. > > -- > tejun Thanks again, --=20 David Finkel Senior Principal Software Engineer, Core Services