From patchwork Wed Aug 14 22:00:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13764177 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 70347C52D7F for ; Wed, 14 Aug 2024 22:00:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB55D6B00A0; Wed, 14 Aug 2024 18:00:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E64856B00A4; Wed, 14 Aug 2024 18:00:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDE476B00A7; Wed, 14 Aug 2024 18:00:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AD7C86B00A0 for ; Wed, 14 Aug 2024 18:00:32 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3D875A1188 for ; Wed, 14 Aug 2024 22:00:32 +0000 (UTC) X-FDA: 82452220704.13.1B56C31 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) by imf20.hostedemail.com (Postfix) with ESMTP id 8C4511C0025 for ; Wed, 14 Aug 2024 22:00:29 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="k9XxL/qK"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf20.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.179 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=1723672749; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Sz+pgwG6Tx1uUhOGcclu4o7yKd27wktU4rb6DA6XtvQ=; b=mI4qFsZnIsxjzpj9z6JCQB8roAV4ZV6LC/XCfw7dH8l9VkAB5WtBOC3ejzHZZPmMc8MyA0 L/Uzy1/bPnRq7xm7x28uNgeqU6I/HxhrxS8vG1fzV4llMkv/ggLLJ+M97KhadVcd6BeimH ESV0itAJ5TsojZ6R3hPTWlFpyg2oACo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723672749; a=rsa-sha256; cv=none; b=3sEfVUA+5mTln60VUA7MY/88eFPyJ5T4MsV5ARCU1uDctYUrFg2Cai6neFROg01sMG86by E9qOqBKbuBT0VOuCovDP9jAgQ5nZA+lTcWB1N24lXPLN/kIb9dYX6a4XEOZUUQHFzLGUel L5fDhe1J14DETtHPDNM14J0NMorIDxU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="k9XxL/qK"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf20.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.179 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723672828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sz+pgwG6Tx1uUhOGcclu4o7yKd27wktU4rb6DA6XtvQ=; b=k9XxL/qKt4zG1aGG3dBCyAmd5Sr42RvCEY0LaEM5mhGJOs3iQS7NWyg16PZugFZD70n2/F 5+lrHgDm6NgICmu3CH9OMHq38yZUFvuCOSBlGCyH6GGhlHYNo2MY4XW3AS6uwM8oVsiXdU O58UoLfoOb4+zfQgfOUYIDw3Nw1MyXE= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH v2 1/4] memcg: initiate deprecation of v1 tcp accounting Date: Wed, 14 Aug 2024 15:00:18 -0700 Message-ID: <20240814220021.3208384-2-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8C4511C0025 X-Stat-Signature: 8xtac1kimof4ydc5wa8qizoptyotqn1k X-Rspam-User: X-HE-Tag: 1723672829-781505 X-HE-Meta: U2FsdGVkX18RRd0AB1AR4xP7GrBMjwuX3KKd8Q1V+4mHsKV7FMvueHCQm+pPZGI9JReahXQHghe3z37WwMcj+4RyFu7ozCa7V4ObYpmtt0KbDE/uD7CFymuHDC1Wa76D1jMGtRPjyhEGpmxYr3ZuS/tjkBTOI6slKlyJCHuXWnVtcxWvyo/V2PJ46c+5AsLc6NdfalNcxK/EuO8SwJfhajnjgGGhMUYvHqqI6c6ici7amTiGETZiewUjzIshHbyxyr0O3nGpVAfy3RN6DebveKsDx1OmGgtOoVUHPFlkP4yo8OC6xZ/2HsxJg+Fv+oBbLIGKjck7KC4h2ko2zGV+I2OuAorOQwdqJfuWhulc+4kevev5qolWQJbbypuRtegF/vQ4psUYm24waEsKWB/oNR3ZlojeaZwtvJCmOz1dfhrD3IWTtVbb7Co4AATgV5D+RZl6TQBzuT/AcrMJOAjSHxB4KJT7x9HGU5iQYtfDAKluNJMvMck66A0hM7SbFG7HfF00LqPqr2qFbo0Rs2KSrjIEgRsckOPoPggDoN2X7tmcadec7Y7EgRZutYQ4EO0LBdz0c7XeruN4ir/umdqPuwWITYozj3Oz5V3k11SMPg0X8m/Dlh9FWSDaswAcvhVJKB7W0N0bjCuGoLv/aIxQvl3K5wjMAxWCE/Aw2s6V1R5vldsCc/+pNZCDChceo1Ct/N26VvTsncfNuYJNczYeIjfafub98zYRNDNcjtM7KqNvv6k378O5MLRw9LKBeKhhBnJLfinUo2f2YHsNKsPlBydgfDcLpDjTnAviAlIzYT6nyNKOx2/SHcBVvdzrcvlNToFsNz+6VqQO+0U6mPFtFD/qNv/8r26YXUYl/onA2iaeMcpjahc9jFJmJ/qoAPZ48NrqyU9pcxCSD2FVy07mQt8pT7U/X7qWCG/mg/dVd3uXb0QoZevPCYo0QQ0AHgS8q5W5XcxHUppwN9/oMPR DOL2vUAW Wzhkh0RkvpwroSigLOaaExkq6s9pLeatzCaCdsIDHv1yNTA6pF7RHy/NkonaK+oiNHTGuMOf+x50oKIc4CxtuZw5/5VBnI96AkiLAfddmrvZ7Kp07BwdxsYSusn+D5TdCIINwD+SPMSIP4jym87V0VXMqLV0+v+5uHxFF/dNaYrNIrr7X61k4vwfw19VPopXt34gE 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: Memcg v1 provides opt-in TCP memory accounting feature. However it is mostly unused due to its performance impact on the network traffic. In v2, the TCP memory is accounted in the regular memory usage and is transparent to the users but they can observe the TCP memory usage through memcg stats. Let's initiate the deprecation process of memcg v1's tcp accounting functionality and add warnings to gather if there are any users and if there are, collect how they are using it and plan to provide them better alternative in v2. Signed-off-by: Shakeel Butt Reviewed-by: T.J. Mercier --- Changes since v1: - Fix documentation Documentation/admin-guide/cgroup-v1/memory.rst | 8 ++++++++ mm/memcontrol-v1.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst index 9cde26d33843..0114d758beab 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -105,10 +105,18 @@ Brief summary of control files. memory.kmem.max_usage_in_bytes show max kernel memory usage recorded memory.kmem.tcp.limit_in_bytes set/show hard limit for tcp buf memory + This knob is deprecated and shouldn't be + used. memory.kmem.tcp.usage_in_bytes show current tcp buf memory allocation + This knob is deprecated and shouldn't be + used. memory.kmem.tcp.failcnt show the number of tcp buf memory usage hits limits + This knob is deprecated and shouldn't be + used. memory.kmem.tcp.max_usage_in_bytes show max tcp buf memory usage recorded + This knob is deprecated and shouldn't be + used. ==================================== ========================================== 1. History diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 9725c731fb21..b8e2ee454eaa 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -2447,6 +2447,9 @@ static ssize_t mem_cgroup_write(struct kernfs_open_file *of, ret = 0; break; case _TCP: + pr_warn_once("kmem.tcp.limit_in_bytes is deprecated and will be removed. " + "Please report your usecase to linux-mm@kvack.org if you " + "depend on this functionality.\n"); ret = memcg_update_tcp_max(memcg, nr_pages); break; } From patchwork Wed Aug 14 22:00:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13764178 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 8D0EFC3DA4A for ; Wed, 14 Aug 2024 22:00:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0ABE06B00A4; Wed, 14 Aug 2024 18:00:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 033FA6B00A7; Wed, 14 Aug 2024 18:00:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E16BD6B00A9; Wed, 14 Aug 2024 18:00:34 -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 C41AD6B00A4 for ; Wed, 14 Aug 2024 18:00:34 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 88A8A1A0582 for ; Wed, 14 Aug 2024 22:00:34 +0000 (UTC) X-FDA: 82452220788.20.9902483 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) by imf08.hostedemail.com (Postfix) with ESMTP id BBD09160025 for ; Wed, 14 Aug 2024 22:00:32 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=wa4X42Rw; spf=pass (imf08.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=shakeel.butt@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=1723672797; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CoKWYd7P/AKTgOxnO9z4vGUx2mh73AJSsiyA7cwqTAU=; b=wibjqp+9Rqo5qo0W1dwGa5POPfwCU4PF5IoWOs99TgoCqqF/nFSBwxYsnWXdN9H5KEwM27 rEIEDDMnFi9/kql7yGk1IeSiLHzOBo6Bpma5q92QTASsaeV6W+3O0ogMzfroIj8Mm623tW 7/ecKvzr72osdJRPckmzCkeKsdmxPWE= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=wa4X42Rw; spf=pass (imf08.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723672797; a=rsa-sha256; cv=none; b=g1wuceoR3pGNwKfdomEiQdZKbf46ZO964MeGXDTnK/FpVg67Tb/0ybkAJauCk4VPz2xOWR wa79pRIbBjXXWgj2ydVa9xpkadexc+41RFhVw03OOPMIn5npwbMlNGRRw2skWxZ/GYmLfw Jm3g5i4s6jUTS7P2Cfg2Yb3hKyoHmgI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723672830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CoKWYd7P/AKTgOxnO9z4vGUx2mh73AJSsiyA7cwqTAU=; b=wa4X42Rwt2kklgTFcAFXO/x/P5VKRQaJFoHFUwFYe4F6hsjQgaSSwKJXTPjuw7wjLUxeYX z8WHwVh0omw5zZdhINdF8S5R0v9ooyocSSy2i3Z9o5cVebyScNQVLRvrhbegTOVl3Vg5zK G69KtcTWY5BZ2dUv/cevweIOqDFOjss= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH v2 2/4] memcg: initiate deprecation of v1 soft limit Date: Wed, 14 Aug 2024 15:00:19 -0700 Message-ID: <20240814220021.3208384-3-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: BBD09160025 X-Stat-Signature: ymyoacwqifqg7yge6bun8ktr4a9tu8d7 X-HE-Tag: 1723672832-884789 X-HE-Meta: U2FsdGVkX1+mqoxonzBnZMawOd5iKWMUO79To4xTq9bK8tBGi7y5f/MDXsG3ElaaiQUE/MwmTVOs+v3Wav4AJuFMHu3E3zZEZvfxXuzN3K14Vip8xyfG9IfTXWkJz+dofF4ZwI/8pysObg/wue1T0SHo0fAkgzYZGK8ioTcvK0hCz1boWa1F3TwbsxYjjO5Obm9haqg651xUeXia7e/qxlzi5afrZjTR6GI2NAU41sw4jl+u1JCI1XWswDu0Yob1Q4hn2jXHdEa/kn8dLDlXLz44TuMBjgBiBWUIgBcKbPUjFKhJxOug+iGEfgEayeZubk1whC0odRDrxNr2UajbPJpWjieCtpJCf+zJ0zaAIaVxzosowuQvnkQpdzHlVt+DtYxFeOsYxmhuTRh9p6oHAsmLtHs1tzbmBI/5g9kLxr4+83lV3Wg8iq2VkAcgpTKxO/hjMCL9juDXGYxI76arqH3B3ZadTgMFzqY0wmsVBGf/fWczhZev0UjU88zkUf5HOJnVx3fiJMHImuUytxUlgj7MpqQ/Z23GPcEzrxjokyJtfAOq2WZDSt6wN7B1pVBibClx0GuKPGGUmKecMpZZUNBkVMHEfbLLLuRDAatVi7Xxs8WtSEWOpPeXzoAOjWCV/CIm67Pyy9Hhqxvg8KjXA2v/mR5gcg0wPFJ6wBfNlublot/MRrxjmmTdOXfEznWlOxAiUZoLzkax9b++UGZQH0Y2x0RvZ8tE2wLg4hJgb6sjFRCsNAwJf5elSTMyA9fT8dSfmXU3xP76bwR374sRzHkkLfK42MdBJGZNbwO5v/PztmrbGFHt7IbQQGNbtWEOn+4mggIw1tV0BFk2p0TZZcJUias9GO1etHj4RG2etPy3h63UuGmTiUpHD7bzb5jWItkWHVHTi4w5x2bFchAQPF53SETmI6pr48TVTh/Z/d1UtNVk/MNTTU6nZ2aLld+0OdVws5RGL+0O3yQnv4X B2jNbJLE lmXcDMxbzaK9UbOurJGISK6MIONvKDquP4/m/rJudjavEnvZ1UDh/AEybqLPxJxhbqKKl5mWRaJRDYpSkwuhrhTkE1G67BpwWczHWOi3QMiDXvAiqsOMncUTonzp5WM1nzqxu3PCtlUJJSdzkKZ+YvdgA/n8LCDLjDfx1 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: Memcg v1 provides soft limit functionality for the best effort memory sharing between multiple workloads on a system. It is usually triggered through kswapd and at the moment does not reclaim kernel memory. Memcg v2 provide more straightforward best effort (memory.low) and hard protection (memory.min) functionalities. Let's initiate the deprecation of soft limit from v1 and gather if v2 needs something more to move the existing v1 users to v2 regarding soft limit. Signed-off-by: Shakeel Butt Reviewed-by: T.J. Mercier --- Changes since v1: - N/A Documentation/admin-guide/cgroup-v1/memory.rst | 8 ++++++-- mm/memcontrol-v1.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst index 0114d758beab..6831c6c16e3f 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -78,6 +78,8 @@ Brief summary of control files. memory.memsw.max_usage_in_bytes show max memory+Swap usage recorded memory.soft_limit_in_bytes set/show soft limit of memory usage This knob is not available on CONFIG_PREEMPT_RT systems. + This knob is deprecated and shouldn't be + used. memory.stat show various statistics memory.use_hierarchy set/show hierarchical account enabled This knob is deprecated and shouldn't be @@ -701,8 +703,10 @@ For compatibility reasons writing 1 to memory.use_hierarchy will always pass:: # echo 1 > memory.use_hierarchy -7. Soft limits -============== +7. Soft limits (DEPRECATED) +=========================== + +THIS IS DEPRECATED! Soft limits allow for greater sharing of memory. The idea behind soft limits is to allow control groups to use as much of the memory as needed, provided diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index b8e2ee454eaa..e0bb54e42011 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -2458,6 +2458,9 @@ static ssize_t mem_cgroup_write(struct kernfs_open_file *of, if (IS_ENABLED(CONFIG_PREEMPT_RT)) { ret = -EOPNOTSUPP; } else { + pr_warn_once("soft_limit_in_bytes is deprecated and will be removed. " + "Please report your usecase to linux-mm@kvack.org if you " + "depend on this functionality.\n"); WRITE_ONCE(memcg->soft_limit, nr_pages); ret = 0; } From patchwork Wed Aug 14 22:00:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13764179 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 A3423C531DC for ; Wed, 14 Aug 2024 22:00:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 343AE6B00A9; Wed, 14 Aug 2024 18:00:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CDE86B00AA; Wed, 14 Aug 2024 18:00:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1466A6B00AC; Wed, 14 Aug 2024 18:00:38 -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 E6D356B00A9 for ; Wed, 14 Aug 2024 18:00:37 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9E9401210FC for ; Wed, 14 Aug 2024 22:00:37 +0000 (UTC) X-FDA: 82452220914.15.BD424EA Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) by imf11.hostedemail.com (Postfix) with ESMTP id E9EED40018 for ; Wed, 14 Aug 2024 22:00:35 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=HBHvyvqn; spf=pass (imf11.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.182 as permitted sender) smtp.mailfrom=shakeel.butt@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=1723672763; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bxBQAPwN/d0yRus9CPsgbp4gq2sSHEHQBj1gyuLTZQI=; b=1XDhuc7lxcw/dqFtN7h1b6VOuVOAr/SI/UKoyOoCvpQniA1JuiX7Ilk43sKg0HwAc5U7P2 /xeHmhcy6egmydEvwV4CfwCQXnYG0lcfBOQLQrdsqIHWI5NO2AXKBZVjvF2Ov14stD/DDL 8V75NI1/ZvJHQ5k2YwT7nf7XwqAgouU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723672763; a=rsa-sha256; cv=none; b=l+yqURahny5W34OERtT9Dita70YJArXhxfmOl+VgfZ5B+f8D5TqKkLOMh819m5+z/eLRfN GFoU4X++3lARClKsnC/z4keKKZJSQxjqSKZ/p0gVDyA0UmvfpwVQvwDTEGUN8jsx1gLlp+ 2J8lskdaJipDPWFOr1O4TKgT4Qd4L14= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=HBHvyvqn; spf=pass (imf11.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.182 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723672834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bxBQAPwN/d0yRus9CPsgbp4gq2sSHEHQBj1gyuLTZQI=; b=HBHvyvqnJWDy2mfX8AyaYzjISdzwSgxz2cvwPXfH0XnskTfGEsloaA1BghnYM50KtOxdUo pLH2sSEIXZGGGiRvvssuaZ8nSapVbNgIOb3GN0fuNkxAI9knDZphSZMcqFUq8YXwUhtLt4 7cNR0GdTGzxwAlyo2uAsX0niIultcOA= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH v2 3/4] memcg: initiate deprecation of oom_control Date: Wed, 14 Aug 2024 15:00:20 -0700 Message-ID: <20240814220021.3208384-4-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E9EED40018 X-Stat-Signature: u8aphd8sjes3xxx4gd7uz7jub7xipzbw X-HE-Tag: 1723672835-386281 X-HE-Meta: U2FsdGVkX18N0JBl8CRMHfBxYi38xPbr5853t0IhBUK4d/qZaUXYLeOBNWpy/4JPB9BGO0iuAsWW5b758tblc6dfAAkt21moUGXj/9V2ZwsV0aUh2EDDZNcEDVADfYgd7I/Ic5/6GR6zD885nXWWP3cDmx6RYP7UmHjuYWvp8J2ksoyLGbvW46bxzmkcFH+q086edgk71LZBQLcA+EDCyMxQ22nplj1jvqDmI5jZYdciFgVMLaE/WkqWI77qpVaSijcP5GPS/obZ2TP6PPwUZibjNLh56M8UQjR6EUaFfgLH02yU+WFhzw9jSHrz+HaYcJ9QbBc8d1X6ZPSmG8KcMxlrxG+OtJIh+EphTejMhQQJvjQFh48FN334DwC69UdWE1dI+SI3EMAMaO7IVMhwKd2+tHZRJ9/RPMYs+MMdNXTXoERhAjJUI4mYXZvDwPG5YhkdEHG5LY4Skzk4KtXLEjR3bau+2VWtPFEnpOjhxsRABKjsoMQTp05qLyJrhUzf4WsbiQqlfdx/Sp9nciasHHsclAfGgDe6aYgFl9AefDH2u10cU5KKEHxZwzhlC4Nj67ojLb3PMdBUkZWwp7MlD0p67JD4Yn62Ee7Vm4L9MUFRdMw6RScidYSx4kPjimVlLXrWz5X8XO6yVwBisae21svnOp6ToApMx4icbCWmGdsjqj97WM7r/hOijdGiKVAVT86rXusOcsfku1QVPEZ2fljdu87rwwsG9qk8HwhB278j/9XVMzxv3q1fJi4d9MXW+Uj7dxxKwLtSiR33taAY/L0cFM1/MyHuLuy5+9UFR9fJIEUfL8oZMaHqWYltwsplSZy0jMdsIvc5Gi/i3VQmcwOZnffUzxrHFuV++JjLpajfUuiW8zWKH8Rse9cb0cN/xTZcHLhVHQheiIl9VlOOAIeUK0y++m+xtq+GP0Un/2F90EZc/qkVqqCJSN1D9SPex4ppk/c391+Fss43pUU 9ab/oimp nGnLanhAD97zazkamEyOWOlmvIXpKUu8B9v/xIOvs/9XIGv/n6H5u7+K2b00EW9qid3HTVhcOwpN+HONRIyXK6ALtsG5kuI8uuedG+6wIbXzjDDpjLHLP0tfS1+tiCo00PNwivQrV5jwAnvNbksqLMq3GLzePauw3lR2Xg93zW0pG73kqojx5SYzSw+cMTTKXOM03do8/HZl3IaQmrvLmU8IhgA== 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: The oom_control provides functionality to disable memcg oom-killer, notifications on oom-kill and reading the stats regarding oom-kills. This interface was mainly introduced to provide functionality for userspace oom-killers. However it is not robust enough and only supports OOM handling in the page fault path. For v2, the users can use the combination of memory.events notifications and memory.high interface to provide userspace OOM-killing functionality. Let's start the deprecation process for v1 and gather the info on how the current users are using this interface and work on providing a more robust functionality in v2. Signed-off-by: Shakeel Butt Reviewed-by: T.J. Mercier --- Changes since v1: - Fix build (T.J. Mercier) Documentation/admin-guide/cgroup-v1/memory.rst | 8 ++++++-- mm/memcontrol-v1.c | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst index 6831c6c16e3f..0042206414c8 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -92,6 +92,8 @@ Brief summary of control files. This knob is deprecated and shouldn't be used. memory.oom_control set/show oom controls. + This knob is deprecated and shouldn't be + used. memory.numa_stat show the number of memory usage per numa node memory.kmem.limit_in_bytes Deprecated knob to set and read the kernel @@ -846,8 +848,10 @@ It's applicable for root and non-root cgroup. .. _cgroup-v1-memory-oom-control: -10. OOM Control -=============== +10. OOM Control (DEPRECATED) +============================ + +THIS IS DEPRECATED! memory.oom_control file is for OOM notification and other controls. diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index e0bb54e42011..334a02597d9a 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, event->register_event = mem_cgroup_usage_register_event; event->unregister_event = mem_cgroup_usage_unregister_event; } else if (!strcmp(name, "memory.oom_control")) { + pr_warn_once("oom_control is deprecated and will be removed. " + "Please report your usecase to linux-mm-@kvack.org" + " if you depend on this functionality. \n"); event->register_event = mem_cgroup_oom_register_event; event->unregister_event = mem_cgroup_oom_unregister_event; } else if (!strcmp(name, "memory.pressure_level")) { @@ -2754,6 +2757,10 @@ static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css, { struct mem_cgroup *memcg = mem_cgroup_from_css(css); + pr_warn_once("oom_control is deprecated and will be removed. " + "Please report your usecase to linux-mm-@kvack.org if you " + "depend on this functionality. \n"); + /* cannot set to root cgroup and only 0 and 1 are allowed */ if (mem_cgroup_is_root(memcg) || !((val == 0) || (val == 1))) return -EINVAL; From patchwork Wed Aug 14 22:00:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13764180 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 84096C52D7F for ; Wed, 14 Aug 2024 22:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 147DE6B00AC; Wed, 14 Aug 2024 18:00:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D2C56B00AD; Wed, 14 Aug 2024 18:00:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDA9E6B00AE; Wed, 14 Aug 2024 18:00:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CE3056B00AC for ; Wed, 14 Aug 2024 18:00:41 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8B6EFC0F5C for ; Wed, 14 Aug 2024 22:00:41 +0000 (UTC) X-FDA: 82452221082.12.5C4C28A Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by imf02.hostedemail.com (Postfix) with ESMTP id C6C8880029 for ; Wed, 14 Aug 2024 22:00:39 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="I3mM4/fd"; spf=pass (imf02.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=shakeel.butt@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=1723672744; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iTKRX6spDgpXKN9MCF3Pa/WT+sJ1zV3S3bnMyq0x3A4=; b=Ei8sWcketcXSn/g1SCIU88Cn4zL5xjvu9htVVQFyzCSFQW6SonmDcpdHnB3vvPkOvSXjlU Wo/lD8T2xDt/BGZRmteEnNoguhesL6xhjuFGO1IaBW6rh55aC1fWEVdKXjkQe4SnkfkZAu j4mruLLLx7CQMD4rqkxcoNhrZbrLKoo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="I3mM4/fd"; spf=pass (imf02.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723672744; a=rsa-sha256; cv=none; b=uWK3ew526ZhyOcaq764zuQrcE2DR/W+jSVqNpoSTury7vYVP5iPzJ4LZPR1upmsd850SPx pU011Fuyj2uwlRlTPZJocPh8lBPvzgbtUkIWhp0VBh2t0xlF9SVW8CyuMWKWxRjEG75n6y meN1zkUzS3N1V0ZhMEVXQ/Pt1KVSmO0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723672838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iTKRX6spDgpXKN9MCF3Pa/WT+sJ1zV3S3bnMyq0x3A4=; b=I3mM4/fdtZrE8ernV/ewmEGCnnv0Puhieiwj1WeFt7TAcdjW2hGuBxWLTrIULHCnqRNurT oiZYA9pG0E2wMZrCeKPKzwJ6sgUokA9GJcg3v8HdLCGRlbVuv9sI2eyRbbfeR+5NZM6qqt YIzUsK4ItOg3v+4dIOfOEedmgWMevSs= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH v2 4/4] memcg: initiate deprecation of pressure_level Date: Wed, 14 Aug 2024 15:00:21 -0700 Message-ID: <20240814220021.3208384-5-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C6C8880029 X-Stat-Signature: 5ap7155of7b39pzjnprcya5aq37cbjd9 X-Rspam-User: X-HE-Tag: 1723672839-608154 X-HE-Meta: U2FsdGVkX19ypB2lNJPE7LCogUyMVAAB9au/dSF9R1vLj56XOwxgaCYwTj0XNmDT98uBisebtlgpyMj+QBNYD6E6v2s4kJkSmZJT+ZmFAuK1dC6WZ+7BXMXVDapTLSaIhyuecvj5qhRTLpspfCWUb2/Yx1N0uqW7cQS6DMbufWM5LAxIFb2Az462cclA/fJldaq5365/j5cbu2bypWJy86aWBQHb8t1yNRdcsVRFkhFaRMaRTa28XUL1cM1GiqzlXtc21sBd24I5TZww7KJHhbLdNe5ah1fT27Lee3tQ6KT1f8H8SRR1svaWUV1BLxPsX2RFMyoJS15orOftcv/RWx2jDjloCWIEgCSJZ+BU7JpTfwxDwqEceuKZHPCT7HNjFJIOAvtAlpTMSoebEHAcz/db3w1J5PAUNRdc7hNjTqtRzuqfoBF+KRSYlaUlgSTdSEmfrpdU8Tns7o4PlTkV/mcyqkPmJCYa23ZyVeYBuv8sHCeWDhIiWMBCD7zpkEe5IcPgSYoQNJp4xbhTRq2j7vF1ZeCpyC/dHXsTguRxuGJxK4la6VbYXvGQypnJhP5bQeu9XX/etMLp/tj/51CuWOYsmyYfOdx4CcH8ZyLrXCxRLg/VVB07h9fv4TEI5mX1gIa1QGagaBhCNWvGen/Z/LfGBxZSinf1pWl3jM7hnf63FZqg/g1QEv/ff8KH3+N4kv+uCh99Xnza8n+ljJAkh6Kx7bjk/i0oNs1U+3m9s31A5yZIQOcaNmIeeh3+BTem+u+PBPrPCupDlUjYJZSOeOVtpwij5P67GfwmTh6BpmvTXRWj62E71YE/o2+XHsTkMnP6zObnAEHps7Hl3H/dYnlwUw5H2lEWV34Eahg50RNvRat6V5f5HSF6a22KlTLo+N2J8gMQpkNKR8HAq4MagsULuw4w1nDV82V2gAiNOS3hMk6q8ikE2ROCzZYE3cRIolIB6pIOsHxy+3951Va 5n5J0+7y rO49NRUwHfM311Znc5YY/gk4XpDWZCIC4b1Nt4X07SUqP4aKRUnlAd0NJWd5HUBdxlGdpin4EryKFyUNZO7YMhc1WLoWZBum0FitiEnQHfSCjCJ92Ysp1YSPL+Cff8IjjthawXCi4Afo0r/6vArdoS7jnOjrBOnchlxybyfoB7rBKop36yov0Ig2bPh/v2JoDe3wZ2W9BgwEPcSOMWP7kQor3Rw== 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: The pressure_level in memcg v1 provides memory pressure notifications to the user space. At the moment it provides notifications for three levels of memory pressure i.e. low, medium and critical, which are defined based on internal memory reclaim implementation details. More specifically the ratio or scanned and reclaimed pages during a memory reclaim. However this is not robust as there are workloads with mostly unreclaimable user memory or kernel memory. For v2, the users can use PSI for memory pressure status of the system or the cgroup. Let's start the deprecation process for pressure_level and add warnings to gather the info on how the current users are using this interface and how they can be used to PSI. Signed-off-by: Shakeel Butt Reviewed-by: T.J. Mercier --- Changes since v1: - Fix build (T.J. Mercier) Documentation/admin-guide/cgroup-v1/memory.rst | 8 ++++++-- mm/memcontrol-v1.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst index 0042206414c8..270501db9f4e 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -86,6 +86,8 @@ Brief summary of control files. used. memory.force_empty trigger forced page reclaim memory.pressure_level set memory pressure notifications + This knob is deprecated and shouldn't be + used. memory.swappiness set/show swappiness parameter of vmscan (See sysctl's vm.swappiness) memory.move_charge_at_immigrate set/show controls of moving charges @@ -898,8 +900,10 @@ At reading, current status of OOM is shown. The number of processes belonging to this cgroup killed by any kind of OOM killer. -11. Memory Pressure -=================== +11. Memory Pressure (DEPRECATED) +================================ + +THIS IS DEPRECATED! The pressure level notifications can be used to monitor the memory allocation cost; based on the pressure, applications can implement diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 334a02597d9a..52aecdae2c28 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -1913,6 +1913,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, event->register_event = mem_cgroup_oom_register_event; event->unregister_event = mem_cgroup_oom_unregister_event; } else if (!strcmp(name, "memory.pressure_level")) { + pr_warn_once("pressure_level is deprecated and will be removed. " + "Please report your usecase to linux-mm-@kvack.org " + "if you depend on this functionality. \n"); event->register_event = vmpressure_register_event; event->unregister_event = vmpressure_unregister_event; } else if (!strcmp(name, "memory.memsw.usage_in_bytes")) {