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 C2AEFC7619A for ; Wed, 5 Apr 2023 14:21:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A9946B0072; Wed, 5 Apr 2023 10:21:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 259E76B0074; Wed, 5 Apr 2023 10:21:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 121716B0075; Wed, 5 Apr 2023 10:21:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 047C36B0072 for ; Wed, 5 Apr 2023 10:21:38 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D58B1C10A1 for ; Wed, 5 Apr 2023 14:21:37 +0000 (UTC) X-FDA: 80647550634.11.47241CB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id ED9BB40004 for ; Wed, 5 Apr 2023 14:21:35 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=bkToI3kj; spf=pass (imf07.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680704496; 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=RTTdlqmjB4Tnp6halJwqBaSkLCugWKkQ+Ytb+SKCQFg=; b=B4p3DngYC64Zy+nEc6mxc1YiQiL+byoXOGF7IGHYunrRiN/9Hs/gaE1MD347CwvGBE9GRm 18AXjkx+KpiBHJkRy+qbY+MZTSAgzXiGpLqsX0sfR2ewq21fZnAifFwYD363/Bo+ma4e9d p3n4cbTRMi0rWfwxl5wZGULG90F/Bm8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=bkToI3kj; spf=pass (imf07.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680704496; a=rsa-sha256; cv=none; b=uIr46QTo2FHBNCFXcfGWkGpCmCTNvNMLHJrRf2qjdBY7b00OLiUF7kgPHeB4eODREZSFGQ lWjtC5xKeKV9Q4qJQTfM4RGuddE3LzCcBVUpU3vo7N7v/8OrngT0e3ePG8Kh8wllf//5qt uG8PNxajdZZCKTTCic8GtViZiBhi28g= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B147062618; Wed, 5 Apr 2023 14:21:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C79D1C433D2; Wed, 5 Apr 2023 14:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680704494; bh=eyBjOtC7CJFOS5X6Sp9ly9THlOS5XlccxmCOFpUhOl4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bkToI3kjLCFkg/Q9XiT8E06SrfvrJtgXoZM39QA51VeWtLgANnUBE7hJ/ogxNxeOI ydJTjh3bdKT69RKz8iF1i+7JV4C9BaVRxmH+dqVKXlurRTsJCPinJ1tXHUEDS8Ui6G Qymz+m9pc6XZp6tnGjnOumjKfK6rAeR//gpPltw8= Date: Wed, 5 Apr 2023 16:21:31 +0200 From: Greg KH To: Shaun Tancheff Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Shaun Tancheff , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memcg-v1: Enable setting memory min, low, high Message-ID: <2023040500-drinking-obvious-bd85@gregkh> References: <20230405110107.127156-1-shaun.tancheff@gmail.com> <2023040529-commodore-humongous-47c3@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: ED9BB40004 X-Stat-Signature: qag1sk1e36bfcm7rod7s1hcraw8ja6z7 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1680704495-547511 X-HE-Meta: U2FsdGVkX1/AbcDc7p393huZAN8JGTG8buURbVaG6H/R5ch+esKjNii/H4OocROzXhqGWdfjrdJQORp2zgAAte6L4gXHVRqoRaebVQ/JNisCjlJVYeds8A5UZTsrCuzvjSgpMdYBi4tIY5iAwolJW1PhtI6nM/vODnzGmbJNTvprMStrZmGloxLvH4GtPINnB/pRKw+H00zrhOK22gnkm6WsARH4HhK9d9fhJCp7nPhpX09z4QCpm9J4Vtt7ntxQHEmnRtqkX00svGJBfDAItqDj6yG8SDyD7igh3V7ReZrk9w9Oo5kckJ0Oa35CSXvoh/ZwSoO99CjAuJyZ38FpIe9MV3258f/Tt48T8w/GZNXui1R2TLmpNyRpWTNSUjkVW1KzA+rwL5rib+6X/+iuWwGG6LHdEgT3+NGajb+lpC7y3G9IIvbdDisFxBovxqQk8OTskkoyV3R/l8kN6hwalH0m4BEJUtD1HDsg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Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Apr 05, 2023 at 08:54:07PM +0700, Shaun Tancheff wrote: > On Wed, Apr 5, 2023 at 6:23 PM Greg KH wrote: > > > On Wed, Apr 05, 2023 at 06:01:07PM +0700, Shaun Tancheff wrote: > > > From: Shaun Tancheff > > > > > > For users that are unable to update to memcg-v2 this > > > provides a method where memcg-v1 can more effectively > > > apply enough memory pressure to effectively throttle > > > filesystem I/O or otherwise minimize being memcg oom > > > killed at the expense of reduced performance. > > > > > > This patch extends the memcg-v1 legacy sysfs entries > > > with: > > > limit_in_bytes.min, limit_in_bytes.low and > > > limit_in_bytes.high > > > Since old software will need to be updated to take > > > advantage of the new files a secondary method > > > of setting min, low and high based on a percentage > > > of the limit is also provided. The percentages > > > are determined by module parameters. > > > > > > The available module parameters can be set at > > > kernel boot time, for example: > > > memcontrol.memcg_min=10 > > > memcontrol.memcg_low=30 > > > memcontrol.memcg_high=80 > > > > > > Would set min to 10%, low to 30% and high to 80% of > > > the value written to: > > > /sys/fs/cgroup/memory//memory.limit_in_bytes > > > > > > Signed-off-by: Shaun Tancheff > > > --- > > > v0: Initial hard coded limits by percent. > > > v1: Added sysfs access and module parameters for percent values to enable > > > v2: Fix 32-bit, remove need for missing __udivdi3 > > > mm/memcontrol.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++- > > > 1 file changed, 82 insertions(+), 1 deletion(-) > > > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > > index 2eee092f8f11..3cf8386f4f45 100644 > > > --- a/mm/memcontrol.c > > > +++ b/mm/memcontrol.c > > > @@ -73,6 +73,18 @@ > > > > > > #include > > > > > > +static unsigned int memcg_v1_min_default_percent; > > > +module_param_named(memcg_min, memcg_v1_min_default_percent, uint, 0600); > > > +MODULE_PARM_DESC(memcg_min, "memcg v1 min default percent"); > > > + > > > +static unsigned int memcg_v1_low_default_percent; > > > +module_param_named(memcg_low, memcg_v1_low_default_percent, uint, 0600); > > > +MODULE_PARM_DESC(memcg_low, "memcg v1 low default percent"); > > > + > > > +static unsigned int memcg_v1_high_default_percent; > > > +module_param_named(memcg_high, memcg_v1_high_default_percent, uint, > > 0600); > > > +MODULE_PARM_DESC(memcg_high, "memcg v1 high default percent"); > > > > This is not the 1990's, why are you using module parameters for this? > > > And this isn't a module, so why use module options, how are you supposed > > to set them? > > > Ah .. guess I'm a bit out of date. > The can be set either on the kernel command line or through sysfs, > nominally > /sys/module/memcontrol/parameters/memcg_high > /sys/module/memcontrol/parameters/memcg_low > /sys/module/memcontrol/parameters/memcg_min But again, memcontrol is not a module, right? > I will look at making these sysctl values instead. Yeah, just stick with that please. thanks, greg k-h