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;