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 3646AC7619A for ; Wed, 5 Apr 2023 13:54:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D06A6B0072; Wed, 5 Apr 2023 09:54:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 359486B0074; Wed, 5 Apr 2023 09:54:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F9C06B0075; Wed, 5 Apr 2023 09:54:25 -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 11A7B6B0072 for ; Wed, 5 Apr 2023 09:54:25 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C0B5D81086 for ; Wed, 5 Apr 2023 13:54:24 +0000 (UTC) X-FDA: 80647482048.12.964076C Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by imf05.hostedemail.com (Postfix) with ESMTP id CD31D100003 for ; Wed, 5 Apr 2023 13:54:21 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Koaw3Xdi; spf=pass (imf05.hostedemail.com: domain of shaun.tancheff@gmail.com designates 209.85.167.41 as permitted sender) smtp.mailfrom=shaun.tancheff@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680702862; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=p90g8z8XskRlnIzzPs6FxyMaFZABDNQoVquJk9cWBJk=; b=DDU86uKIYGjouJ3SmmTLVgIxNUorVPTpElbwVB9EmSEcw/oK+nVtsT+lDHN+XEbc2LxUDE trVUcRDpSZAZtFj5vrGpbY5hn19jF8vEND+f9XfD3wIGk5YVoVwH7AWC1LCOq3C0gqcZh4 qn2KwDzMAfyXkpNeGAjs4RkkKExH510= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Koaw3Xdi; spf=pass (imf05.hostedemail.com: domain of shaun.tancheff@gmail.com designates 209.85.167.41 as permitted sender) smtp.mailfrom=shaun.tancheff@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680702862; a=rsa-sha256; cv=none; b=wCly6pBaXa366kVFrmjPERkpnf6ugmDNlQlnIqdGjZzwZRXZuAfjeoqj3piWR+TWYrtELK fOEbc/6/nFKFrC9NzHSibBMNK+vCsoQBCuAayj1tPIKbmbM3p7PY7Q+aVZCTuVvC0eD7kF opV3R7OErRz7qY0alyTvBO+aQYG8prQ= Received: by mail-lf1-f41.google.com with SMTP id d7so1727474lfj.3 for ; Wed, 05 Apr 2023 06:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680702860; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=p90g8z8XskRlnIzzPs6FxyMaFZABDNQoVquJk9cWBJk=; b=Koaw3Xdi81T0JxsVSpWiN/5aTgpi3moIsEYux6MdCM1aRSHqtMmknWNU0DvfLstjOO Aj1vt9AqhSIYo/KSaZCydJrMjse43j7zR1eiat+4n9HLUPPdfHPKq6wxZhlH6VZ0EFzx 4H7Jxyr4ZpiH4zwc7NRKjoHRPwALTNATHtl4wfp9pDoptJj/rwsc0401f3OX8kQEZKd2 YLj/hH5hS3O1xhxkbOY+qnti7WuL8FZWCV7MAjBJKBzjah27Xebkw6IBrDg4ThIIyNcl vPn0j4+suTiTZ5ibrEKK9PKSERgRcUVMWToIYj/LF/G1tdAwt0v7Ph2x/D4pUjvf56dg gHoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680702860; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=p90g8z8XskRlnIzzPs6FxyMaFZABDNQoVquJk9cWBJk=; b=Le9VxS9o7rohmnKV6M7z7gmbWlCYY0tCJvlKp/ge22aVisgIWtqr7o+4cQFZW7lRLA VOdvciWTPv9/LHiphpEklbJ/930ZRjoSjrXoqTEjvWFHPf9mrP64JJYEbW3d02fNZRLX j3rjBta/+WvvZk8ByOmeYLLPP9JOa9lYDFp32+NkAgJyEnSaibhDwwIOFw+O0FoNrJzd AGZpPyCrf9qjKMkdOLDm6nlDt2sQ9qndhIajc76IBhsEQ0suxybLVVy8Fr8ICQvCrwSX nHGIPfhEYlCKUn40ksYVJ/fs7o28pSXBP0zFExuIItcswF+6YCZHao5N8YduwPgrj2Os Hwfw== X-Gm-Message-State: AAQBX9cZwGi2i88d5Ua0YZpFd2jT+MUFwR49mU+DKv/kpRj/mH6zYl8V OFmtXIjkP4g0XzrnXpscWnNPJPxC2oBMCHuWAjc= X-Google-Smtp-Source: AKy350YTXoLe5a7rmOrDhaWID19CdUGmm4J00fJYLx43wqIa9nAir4DJQP13+K8+mUm6f/pOb+e94WhwryoDH6kJeio= X-Received: by 2002:a05:6512:2808:b0:4d8:86c2:75ea with SMTP id cf8-20020a056512280800b004d886c275eamr1481258lfb.3.1680702859509; Wed, 05 Apr 2023 06:54:19 -0700 (PDT) MIME-Version: 1.0 References: <20230405110107.127156-1-shaun.tancheff@gmail.com> <2023040529-commodore-humongous-47c3@gregkh> In-Reply-To: <2023040529-commodore-humongous-47c3@gregkh> From: Shaun Tancheff Date: Wed, 5 Apr 2023 20:54:07 +0700 Message-ID: Subject: Re: [PATCH] memcg-v1: Enable setting memory min, low, high To: Greg KH Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Shaun Tancheff , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: multipart/alternative; boundary="000000000000ea03ec05f89720b1" X-Rspamd-Queue-Id: CD31D100003 X-Stat-Signature: u57g48x55ec3gghc67wshn6f6cxm4tg7 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1680702861-519488 X-HE-Meta: U2FsdGVkX1+x8id2C4HBkskaw0H95Q7S35uARxC+lx51CL1fIcAdP+CQr3hXr+eRUdRrqdqY3PpEc/5e7i6x+t5/QLq3bJ01fpJ93fTKrldzNHLD+vLfN4gB3Nmwk6wMOt8clXZR1DlvKJa1T/jvxhrBD2iz+l3YM50JM+oJ8gMgHTulBl9DxgZsrVBltPLrF+4Wp2QHUS8cQ2sph6e29xdjdrud0o57vScKL07vERS/pKf/CmaqJzg4+MuuoMfmgfgmiUs/kOcK3F8+1jE9b/zdeFrUfLvehlIqLq474pMTKZeQshXVfGNI/rQ6UuSx2LgtBJ8f3lY8vVG1FCO9ksj4MNbmB/dXv1i1ml+jL1HMjLw847ZBfRYH8eogbfLKrp+6AU34pzY+Leujp4SmJlRWoCagB5VcjLJ8VGD3598W/y5uM24mkdO+VN4aVctjvDK+SSRyVUgFtRUu65fF7LCADbKWIDyAfFbxZJu27UlinIPeMvgMYmvcYcTWyruZiCI32jwIEK030lgB81xDIAnyBHM+Ja93Hp518Op4c3tCSYKaRRRvJisdcJgJfKoeHvZIVyg83LRd3nWoRB6F4UirLJz6iBg6IO08rq1ZEgDyA5mFzAFJNP8usZCh24tgK3b1dbKz+ijB5pH1w9n871ObXMd8lXUp+c/5ySDhK/U0Rl10SDN1TzpjBxwQqUL2L5GO5fg1ksPfXigzBIlfH0iuP5abcWO8Kc4j+pspA9ufi0qBU1ATvaV+wMHZ6/1iPMd9RkBBukd4E5vrOFcIaG+O/6LfRqK/GCKf8yHBopiBzY55Spr4rI/niXR9pXwdzaotDgzw5TRgJpWh64FnLZ/eT5ueVYcD6TeViP59zhHoi9jEQKN5Ta+TJZxeu+Tzcn4Cp3U2M4ASxZuYdLNyJ3amxUkuvbO5WSsbbc4/5PK//2CcvRZkXaGgywHm2d1ISkjEQVU65D4ns5+7aTQ SRcSwdzd k9r9WGqHlYRL77jCDQIV52LouR10BclWfRMA3/UrUS3gdwjv2GZVhPjtl1qqhPHVD64bAALjAgs8ptv/Dh1E+2e0AVnZAllU8onmFrcltCYYVXFuotnZ+WV4b/aB/bAkr4aho8dcphMK3RnWpr/x7QzxcnpnaTCqW+lAOQu2FhGufi9X6bdMByXd1Rarnnk+Yw1L/ukI6LDWD7KY1PmMtqBHFuARL6yH+zD4y8PdbIigv9LFzzOU8/vmDtmuSiF4CFss7inFoYt+pbWt9PK5bpXgyU3LjsE9uTdi1ScjGYWQkW29MQQfBmHvuZtgvxX4i1wGR07uatgUCCsSxMdoWnFrAnD7dYB9iJAQHKkwSjCSpj6kNhkWMUsDJ70UJxr7/h6MrUksLfwrOIs4iTZ3kwoQE8FC3atNl2YN3oXMfVRFANJgFgX0Q+S/qTSSEciRiUwPrYRj+yOq6FhF1dVNUj0R6LAHJmG28kr7dD7kue/x/Jo38IZnE//odKIclEKQjnV38SGTuJD/rr+k349t4C8yWl4wROT0/bdh3jpvDERPwEDS2Evx06JO6tEMHksJWK4vPM5YiSzvmqYzyqh0B0TT597JAQTlVWsK1mxb1Ny0REZneJgsgsvrCZOZdIozKXEHksRBqt/scNxWoVxX61FpYvA== 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: --000000000000ea03ec05f89720b1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 5, 2023 at 6:23=E2=80=AFPM 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=3D10 > > memcontrol.memcg_low=3D30 > > memcontrol.memcg_high=3D80 > > > > 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 enab= le > > 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 I will look at making these sysctl values instead. And you didn't document them anywhere? > Next update will include documentation, as appropriate, Thanks! > Also, why is this cc: stable? > Apologies, I understand this is not suitable for stable and will remove the cc. thanks, > > greg k-h > --000000000000ea03ec05f89720b1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Apr 5, 2023 at 6:23=E2=80=AFPM Gr= eg KH <gregkh@linuxfoundat= ion.org> wrote:
On Wed, Apr 05, 2023 at 06:01:07PM +0700,= Shaun Tancheff wrote:
> From: Shaun Tancheff <shaun.tancheff@hpe.com>
>
> 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:
>=C2=A0 =C2=A0 =C2=A0limit_in_bytes.min, limit_in_bytes.low and
>=C2=A0 =C2=A0 =C2=A0limit_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:
>=C2=A0 =C2=A0 memcontrol.memcg_min=3D10
>=C2=A0 =C2=A0 memcontrol.memcg_low=3D30
>=C2=A0 =C2=A0 memcontrol.memcg_high=3D80
>
> Would set min to 10%, low to 30% and high to 80% of
> the value written to:
>=C2=A0 =C2=A0/sys/fs/cgroup/memory/<grp>/memory.limit_in_bytes >
> Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
> ---
> v0: Initial hard coded limits by percent.
> v1: Added sysfs access and module parameters for percent values to ena= ble
> v2: Fix 32-bit, remove need for missing __udivdi3
>=C2=A0 mm/memcontrol.c | 83 +++++++++++++++++++++++++++++++++++++++++++= +++++-
>=C2=A0 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 @@
>=C2=A0
>=C2=A0 #include <trace/events/vmscan.h>
>=C2=A0
> +static unsigned int memcg_v1_min_default_percent;
> +module_param_named(memcg_min, memcg_v1_min_default_percent, uint, 060= 0);
> +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, 060= 0);
> +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, 0= 600);
> +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 i= sn'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=C2=A0can be set either on the kernel command line or through sy= sfs, nominally=C2=A0
=C2=A0 /sys/module/memcontrol/parameters/mem= cg_high
=C2=A0 /sys/module/memcontrol/parameters/memcg_low
=C2=A0 /sys/module/memcontrol/parameters/memcg_min

I will look at making these sysctl val= ues instead.

And you didn't document them anywhere?
Next update= will include documentation, as appropriate, Thanks!
=C2=A0
=
Also, why is this cc: stable?
Apologies, I understand = this is not suitable for stable and will remove the cc.

thanks,

greg k-h
--000000000000ea03ec05f89720b1--