From patchwork Wed Aug 14 20:28:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13763928 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 D4E8CC52D7F for ; Wed, 14 Aug 2024 20:28:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60CDC6B0089; Wed, 14 Aug 2024 16:28:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5957B6B008A; Wed, 14 Aug 2024 16:28:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 437176B008C; Wed, 14 Aug 2024 16:28:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 217066B0089 for ; Wed, 14 Aug 2024 16:28:48 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D6F228119B for ; Wed, 14 Aug 2024 20:28:47 +0000 (UTC) X-FDA: 82451989494.22.F17C582 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) by imf07.hostedemail.com (Postfix) with ESMTP id 11A194000F for ; Wed, 14 Aug 2024 20:28:45 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=vvo2dAml; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf07.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723667267; a=rsa-sha256; cv=none; b=Wq17YDPq7zmnCIZ2/niX5hXjtqaG9CAIOo0PZRGWIJKz4h0WSRA4KWfyHze7ns3mJM/i6N 3QowaUlZgL5YNYbKEgxOrFKM0/00y+qddJpNQFoV6mjvDDgTuV4oFXjvZQqVecKCMFkAbr DjwWcQzngvuUhEc6ZUxFSskA2sXfIps= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=vvo2dAml; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf07.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.183 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=1723667267; 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=YuTcvSW9Di06EfL0eDnFgAZS8RJd4NfEvtxJHSVe1sg=; b=EH05iGoVO+zM7lozoTk9iGXeqZ+d1XyGVf/fuX/0pLKS1olKa4KqEPyLITl/4pprM/V4VJ e3WuQtuZ8gsXkMJsQysuYuM8BqHIMZnFAsuimafReS+2QObVavHjTGJLHbQ2qFZ83wNP99 AgCYbTuOcTbd266kW2gcmJ9B+cVmhFA= 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=1723667324; 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=YuTcvSW9Di06EfL0eDnFgAZS8RJd4NfEvtxJHSVe1sg=; b=vvo2dAmlpYSQYHhGtKfIuWJfO+kJhk5WnvGdclU5CU9cDOmn/jsaasYKEFAhDLlCloevd3 +dExAtypgTNUQ+nNTXmJ/j/EFS1cHLkgaYnmoDiouffshNOgBHAapG+utAWl+Lu5osG6c9 CWLZZGuJQ1RMm71iqpLzwNABbwK/bLU= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting Date: Wed, 14 Aug 2024 13:28:22 -0700 Message-ID: <20240814202825.2694077-2-shakeel.butt@linux.dev> In-Reply-To: <20240814202825.2694077-1-shakeel.butt@linux.dev> References: <20240814202825.2694077-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 11A194000F X-Stat-Signature: 5s47qm6y1sxers6ygrp4k3twzt91exzh X-Rspam-User: X-HE-Tag: 1723667325-789824 X-HE-Meta: U2FsdGVkX1+ZsXWpnvnEAPBoAxVF+SkVZ8/F18m928HzERH7cO0lHHvWh6L92gnc+byDT8pTSCAat3ilXwGj4+MykBMM4xpEagYyMZnxoyXzRYW5BK8n2Qf49lyDwpIBE7YZNIaIErAxlbW2RiJVog0PvBE+3F+sGQvu+Tjamc2HjsAJMzh08CkfHWmbrMM1aheNDPU3UnDZLyfn5d+Cue4F1zTIvrqPFF4ZTN77QlkUdj+4+qgUtrOvEkU2gJDhBHAnuqPztkRYPKfaloeJ5n0f91PlMa5w8EpC5oq1taDXmzD0b0NwP4phk40w3PCay5rfICVfMeP5tnIQ1f58qEvBOWL6lFk7XiyYzwD4AteOFiSvBvjyC82PFc1CcLVbxH7jJlnR62Lka+t9AamrW8OfMII0Yz/R0pnwdUeGKEOY2OiY+7xCzJre2G3/LXiHpUsABhmyad9QlXUNgvl6P8FEKDZqeDcERnmXRmj1pUgEokrBPWrn+vncQKOWBUO/0DRth0VGz0o0P6Y4o1ml6HvCYzv46nQd3TwM2wBaSNBq6QLh1tI3pi6BpIvxI3AoxEAYz3jHhX1URFTQoK8g6tIyliC8d4j4c8qJaM1whNzKqx9iwNiLIGG2mNRPC3fuwz5P0miQqt1JJJV4HTaHWKUf82H5yoLdVTC7pY1JEHO7X33uKcWf67RBA2aYYA+eWn6Pkf4Kiqv/XNZI0FMygUY4EetF8fUdcyptPRG1bdMoMcXnI1UlYH3B4TyK//GACYTUWYIufXUCG7t+aEgJzMYWSOTlvaWo05Q2XhtszH463dS40WUueG0ab2Yr3/eNyHIRgSqPy5a5dXq+7rgQGR3hzQCWU+t85Ue7f8rtV3VjRHjWL9FB5qFWIkKYSuSiAwI2nNZAZcauRgxW9VwSkKQITPpP4ISHdkLYAaMWRtErzTcv0a7UZ7B9NE8SrR1r28gBjPC2CKy7/azL2jD HcXftNKV lI4sMkl252QFyLvb5au7dYut1RdDRAzNGjZnuMRPhaVrGhWPZ1lWwM7YpiLQTQFrTXeA8e6N03wg6z7+pGxdLMX1ti9MjmDFSAl8GuJBTI5Yp3Wnc3WqFQOKQTBgrLveANNhEXURHBp7dMAxoEt0hDwedQZZ53mrR9vIHDcOkbdSZeck= 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 --- 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..fb6d3e2a6395 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 + This knob is deprecated and shouldn't be + used. hits limits 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 20:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13763929 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 CB306C52D7F for ; Wed, 14 Aug 2024 20:28:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39D456B008A; Wed, 14 Aug 2024 16:28:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 34B076B008C; Wed, 14 Aug 2024 16:28:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2609B6B0092; Wed, 14 Aug 2024 16:28:58 -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 F3A946B008A for ; Wed, 14 Aug 2024 16:28:57 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A0E44A809B for ; Wed, 14 Aug 2024 20:28:57 +0000 (UTC) X-FDA: 82451989914.04.56CEA62 Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by imf04.hostedemail.com (Postfix) with ESMTP id F0E2F40011 for ; Wed, 14 Aug 2024 20:28:55 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="mZtHF/+X"; spf=pass (imf04.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.175 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=1723667264; 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=8pUIHp5n0Uar92kH9etH8g4haQHVbq2z8GQwWBMKVbI=; b=36jIUsMfa7/F/TgNkKiBWgx4JSKr9dAlRmT0wtYYHtxtsWzGMJSzQYEwZelEwHtLdQsYNs uvU3j9mtUQXnhcrLucr1tl+a9pFH6zBvBlya7IALyB/G9jkwtTCfBkQYR1hzUKSm90sKSF NCCqLXdOlXxFMyUHDKgleqfAXco2cdI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723667264; a=rsa-sha256; cv=none; b=xvDC+Ia5kGGU5zZVEOWbX3lRo5jPR6LVDe+MR7e3qs0iN1SaFD7RQVIJZcNm2Q5F6bKumV 0Bske7WoMny+k1vtZtT94BS0q9z278tQE3UciJnEpLvOgGgLGVT5C+6EsKKhSekD+vuQhy Pz+hJKjq/8Gi5YO7bkSBX8QO9nNeXdE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="mZtHF/+X"; spf=pass (imf04.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.175 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=1723667333; 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=8pUIHp5n0Uar92kH9etH8g4haQHVbq2z8GQwWBMKVbI=; b=mZtHF/+X+qPTZcKMFtclAXikUnNlfUnwTEG4tmMmgOnlawA/B7BHf93jTy2dB5PmVWzF+K 83+QCsTr39iKyFqluczw4EnCKNFyRrQSJyD9+RRQwFrUxEWYBb5TLwf3MV28ldF0WzTUtH Y0QfkRW+ayHV894fjUUljDs+3fwec5w= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH 2/4] memcg: initiate deprecation of v1 soft limit Date: Wed, 14 Aug 2024 13:28:23 -0700 Message-ID: <20240814202825.2694077-3-shakeel.butt@linux.dev> In-Reply-To: <20240814202825.2694077-1-shakeel.butt@linux.dev> References: <20240814202825.2694077-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: F0E2F40011 X-Stat-Signature: km1ka53cnxhmcyytjd1wct4gbh73trsa X-HE-Tag: 1723667335-428359 X-HE-Meta: U2FsdGVkX18H5+9FU7ztzqa/mzzEWpW3DDVsYIeAqyrhmrP2HlU2ESDrtCMpZXUk0QELZBhqu9+uiA8Ni6gDNfroUSN86/FFyLZlAo3z18Zlcy+m1XN2qRMrFfU8L0ZBxGBirdsHemIGNgA0m1UQA83AnlH9QtZGnqp1f8wGk+BsU2cBAdtiZaDRg3SbHPmEimJXJbpdL/oEQUPOQCHFcsTQpf4T8Rd5+q5g1LyXosL7aJxDGB+M1yTWatRd/6cEIL1A/b6yTxHuEHrEDA8S/wIYhrG+FR2H1K3eXNBx+mlSZOuWUog9H9YvTmkqRlW0ZfuBv+lvYTRM86BTGmureakET7jtlfQn4sozBrQ27JLMQrBvlkVt+1+XJJfXdie4h/ZgsJeN+ew1mIuclVzOGE/5ykcJLx0347sAn2dKsyJMoVM6AmimbtywXA9yb3Lo8ddFUr5opD7en8RjkiinphNxPa0sgr4+brVKr9DYiN/kR7EXq9j8mYY34UrzAaecT1RYMJuI5pkybghTv3Ap67jmWrcRdEziw5VjtjXLkMewOrlSkL6pf0HoGK85VMK2oMcGGOyvLx4uFgYjtAPdTfTFtRteyoqzdD6eO9Jc4/wuVBtva348NBy7wATc4JaoQiBSoMzEYpEJSBpvo7kdzNDb3ZjS6rWMK00GMQa2b/e5Ku7e924oBBKL63W/zVj909cNLEN1t8PDwcMQYOfPjau0JzKEk/nWK2qK4ndyd/f82KpdxjXv7JDco8cWYkLfGtrslPr+XYiWE7TFHVKPzAsyoxkAA45LpjxW0gUMEx+NZYZwsJnMmky29XJendS8uQDBC+w95DKzFcO/fgnhUj1Zj3byFFpwuTwVpmibfn/IleBlE5DMZ5nbhZ99y2QbIvsTQ1f5dU3Hw9xv8pcNKrwKX9WZ7yjgnAoNMUVk5pbjE2N6Nn6vQlIbddpsV33/wydu0xKQ2GsFWVludLA XQOaiVWk DiWU1Nc+fAhuErHAEtYh3ObNnH9PuB02d2k2zkfYM9eOY0Ytd1YuuZDwEIcacePh94OoXSWbmelExBg9X6Xe0xTBzrGSn9E5ZTVE8eUlmhwK8ay3R72770qgnabKCFK8Yb3j0FDKbKrxvyeWHT6BpovrHPgoWxpy/y3AphOd6cVNzf7Q= 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 --- 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 fb6d3e2a6395..afe5e95e9f7b 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 20:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13763930 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 9AE7CC52D7F for ; Wed, 14 Aug 2024 20:29:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 373CF6B0092; Wed, 14 Aug 2024 16:29:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 324976B0093; Wed, 14 Aug 2024 16:29:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EB6B6B0095; Wed, 14 Aug 2024 16:29:02 -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 F32B96B0092 for ; Wed, 14 Aug 2024 16:29:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 961E11411E5 for ; Wed, 14 Aug 2024 20:29:01 +0000 (UTC) X-FDA: 82451990082.15.EE663BC Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) by imf25.hostedemail.com (Postfix) with ESMTP id D39C6A0002 for ; Wed, 14 Aug 2024 20:28:59 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="RTxI/hF6"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.186 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723667281; a=rsa-sha256; cv=none; b=HQXzjx9WmeLWcgRv3VaHiaUjt0+pmeRYSr6mJyvVMUmeVu+KvtWgAK9eLdnL9Tx/K2HGgw BqJso6LveiSY6vhJsMCfmpGpFFQYw8OfgkU+A7jkPSYS1YATYomnJ3xAfxfeM4u29H4DRE Zgu7A+kv8RSCtYVQsUP0itZy4WCvKZA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="RTxI/hF6"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.186 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=1723667281; 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=+6nvSZOz9QE0QcmtJItvdiDiC1dkEI/UgvNP1v9wjb4=; b=P/SZMOIS3xxIWoQzzGcuGithp3ie6hVRpd/DZmifIKYU1JR7rPnjx6l+orssykVv3AX1nI HGdXQE+VruU5UvR5fzJzBbNPR1kAvKpdd3bVi1R/izJY8UXiH+SIpmISm3geTxjS3yDGX0 6jRu1RvZl0JNFqdKXy8dwoNCdwrNxrM= 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=1723667338; 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=+6nvSZOz9QE0QcmtJItvdiDiC1dkEI/UgvNP1v9wjb4=; b=RTxI/hF6U5aR5/x110KhdXByEqtBRQLDxyno0Bp2FH/8UaaMMtMvvQUEcE747xNGGj5ZAr Tzu6Y4xh7inGaVCiMWkjcaY2vnpDJ60HeDDaEXrgiX/nSjlgUooZ3qit0CZUAmseLcoV7m LRpmuCJdmOrvK95RxEn3g3Y/WyXoLRk= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH 3/4] memcg: initiate deprecation of oom_control Date: Wed, 14 Aug 2024 13:28:24 -0700 Message-ID: <20240814202825.2694077-4-shakeel.butt@linux.dev> In-Reply-To: <20240814202825.2694077-1-shakeel.butt@linux.dev> References: <20240814202825.2694077-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D39C6A0002 X-Stat-Signature: y4hie8z536tkuc8ruaw6uwmpkjpty65k X-Rspam-User: X-HE-Tag: 1723667339-868059 X-HE-Meta: U2FsdGVkX19mt95Khi7iU0evhBT6WPUo1oi/xRuI5Ua/ZQzjcWW5XwWPzA8TSn3pI9sKT/R09aJYxjWR0UdqLYv6baG+NgJmJlfQAp4EE2AqRv5gdwSYyKgiq//Se/2g19Vs0v7toNqIo6I7b/ShmdbCJDIaG1bDJEojkFcKSop9GpVupOyeVtF4pQi0aSlsa3wfKJTgQZ/rr8Wk4YtcxqUNeS8grismcqBypq3mqQbG836q3kURQCXHU+ouwzUwApjkhb9l7eRCbOaxBR8cjpTKUwzkxo+xCcZEd+Uu5zxKFpeTp0WFvRQFlYLm27GuUxhZqX/h2S7HVRS3bbseHV+6nH5UcFR0psV0K9STUPBTaHc3IATkxNB1fT2CW+EqYnrCrTbH49X2VYEstx1U/Sozz++6btZz0l9Qv7iv3qu4Qi4U7ZhhEzldIRXuQDMR3ypDHwzB6z2NuYMJLTqE5dofcUXya3JJjPcHqwvp2+iF9aBcX6dCh3NDKC9z1RpmK6+bEh3ZaV9S+ptNyewJCbqhBIBOUCFQ2tEck6kiHMP8DwZtcwXMqigHs6Koh95Gduv0IoLzHSYK27ACMdYlX2DhdG4TCOAtkzbRBOwRaBo/1o8cUH4iGAFzaTPeqKvVz/gM+ODB0fkhCa0RiFDm2NBZwUHMBuiIyo7q2VbzC+I3lgp1p3S6fLvTY9MFm5pYly6912BD/DPjQMWxxBmboar/7zprq4rMOHffXLZ6f6eNcMpndfgi9t9NYLldLND+D2YKt+8i5oqiqn6gSHYTKSb7WMWVuCaR4E64msfKd4JAQxaeyxs9JKKdfQGzj3YbETCpa66v6Qu5Sv1pcfFSkO1IVyGX81j/82VpCZo6WlJGcdbl5gY+8VBkQW97oBwRoLvjutsCGXkn3gvySLP0zkjePO70NDoYQirsjK6/A0Bzt4JSR3XmHkHi2WRZgGsgniifT6uK+0J+oSI473t +8QRgans P5IkMfdbzLKX1YrPDIHZYOHfWHfeVeqwY0yL1oFcF3NrbrenV+QzQb/Ar793Ozg0+9EWVWUc54FLK16+N8/Nk7AzcBYW4kJJ9bsUHoY+yR4RUi29+DSQdzrBD/w/rsNIKxLXscNxuBUwx4qb8unYgAFh4WrzAiLs2lAdlyQmIKmRpP69X3Ad68IUR/LcnKfTgS4zKfVfxiM164jQr2GzuYXbVig== 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 --- 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 afe5e95e9f7b..74cea6712d06 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..07343e338e4e 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 20:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13763931 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 26E56C52D7F for ; Wed, 14 Aug 2024 20:29:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B15466B0095; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC5BE6B0096; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B3BC6B0098; Wed, 14 Aug 2024 16:29:09 -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 7D3AD6B0095 for ; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 443A54123F for ; Wed, 14 Aug 2024 20:29:09 +0000 (UTC) X-FDA: 82451990418.28.93B828B Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) by imf01.hostedemail.com (Postfix) with ESMTP id ED98540017 for ; Wed, 14 Aug 2024 20:29:05 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uYIww40y; spf=pass (imf01.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.186 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=1723667250; 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=3eCpg6JY4xdfuSX+uQFFlngNTZJeJ79jR/+n8cnnPGg=; b=gkRR3q6UwU/kZh5XkX9SYGe5S5dbhFYjeUWiM4j1tuwEkxaYDAc7X9+Cp6oZFIjMEGGO20 A4Wu3D0s91AVaSgfzDclsDa4pm5wMjeCHcYgRSb5xX7soDqFxUKljhwZtM985VEv1rnZFd w+XkRAYI3JsXV1Vt04jTqo9M1MTNiag= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uYIww40y; spf=pass (imf01.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.186 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=1723667250; a=rsa-sha256; cv=none; b=d8o63lvlvXEgLsyKOtdccT1Pzc+CrqH6CRAE462P3v3PisszCz3NKYsKrnmaBdn1XnqtNo H89qVx+eogMDrLfQ3B1mtU+2cGdNY8Bl5Q4n7dU0yUOyE8QUEY4D21XKgTc0ZD1eXIy2TB k2w3zr2KtyVE5kUw5yX5L5G5ugfsCVQ= 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=1723667344; 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=3eCpg6JY4xdfuSX+uQFFlngNTZJeJ79jR/+n8cnnPGg=; b=uYIww40yZ2Xis6U+cV8wV/Qs15VdbFr767xvkUF6MKj22Z5GbZZ3gW76QyP813dZJJC4cN MmTNF4nMADLnjKP+viVJokLJazSp/Zr/b+oElSTlj+7+bo5blba50dZR8ER7c/fKvtdwrG 2YVGk1D8gSWKSpDZE6ngs16vo+I9uI4= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH 4/4] memcg: initiate deprecation of pressure_level Date: Wed, 14 Aug 2024 13:28:25 -0700 Message-ID: <20240814202825.2694077-5-shakeel.butt@linux.dev> In-Reply-To: <20240814202825.2694077-1-shakeel.butt@linux.dev> References: <20240814202825.2694077-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: ED98540017 X-Stat-Signature: 99hmhipt85cbp7p4u1ys3beh9aurytr3 X-Rspam-User: X-HE-Tag: 1723667345-887012 X-HE-Meta: U2FsdGVkX19uQFJSa6+0pn9YxxpqdU60Hux5c4elNkny34v/1hYItNV9os/gqqghUfHa7oIIo41KX7h1t2qg4n8pm7yv5zpnRLc4Rrjm2T1nddrvyNdyahObYXSMYpFBn6kKx8ZfMRU2hQxsyN2kzaB3lzpgATjgnaRX5Adi81SArz8Nq7P8A0Gr7gZMVBZxUt0V1ARs9nnZvteA3LK5euCwgl40GIsU3GWrY3zcC3FpzlTC0sMvReEB+w6Qs8BpBkYy3U/QwMFRRJzxG7qza2dZzeQfLmqHCfcyH0epcHt55YL7Ckpn/d9+SKinpwixjRX7Dy1vs0jbhzYoM3zxzgjNvdGBcB8heIPux4mWf++y/I5qEHYWg2yfDChJ9LZBAbBwnt49mT9yRLueO6OeelQl1FQOGnGTyk5rIQ/C7ot3Vi9p09A6GPk4cUDN5d6+0Oz13G6V24D8eX1ii5+mktTkVonriQFf9yzcinIQNaIAE5SGKFk9Q54TixX7RFY04FwmiCcUvLMsO0vo4SAwSClMv5sFtCUaKBdf26DtLDSzk2qbtLP/7wAbJc/GPU/TMBuCN5pucs4WiNkPu5iqZaMqD+MJyLR6K7vuSy1rZ0Px4U17wcX4omKn4WGW+9lgXFR8jbxCB20k/g3Tn4KbqeV4VlQatMKNC0mnOHNDw/Ms6CyQoeHW0VqdZ22lRwodMbzYoXUT5apgo+aKCvB3GZM7wYNuHfXufDglZRtSucI8N6Zc4vPx1iVZG0Zdb2st/Z6N80tcfwrMugknKd03ElxxWObnvR4cSenODNGpMEGYVO7nDOiM3BMK40v53RGgSESNJZP0dqZ3h0xLI6KC06XmUzRD2BaX7VFselbJSJ+nAfyBKZJkxyxYPbEiqiR/9yG5oTEPDQgEc2QGCvwd44PDoYsbDpHrWAAeuzMe75yNOrhyRbVkD2OS1CFXsQ1MbWXgU1Zf2ic1XA3QNOJ lRJxfYXj HrQWYqnrdalMM8d+JRo+7B27tzR1lS/qJXX4qdkvdEoyz9enyTIo8cIhPAIxfWc7Fx68/QdChpLpahPbIMF86eod82sTb8erhDjCAVnon3uqNXfRpyiwOA2BrtxCbt7ezcpVWKVtf32DuylzaLdEA1CjqoQCEQ7EQc5KKrrvFfRX14OWl+UKBbApZC7UOZYNH67BuuZlJHTUmBscw2UjOCxR5Dw== 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 --- 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 74cea6712d06..8ec1faf08b6b 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 07343e338e4e..420c7d15f12a 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")) {