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;