[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLl5XA25BIlYyngD@bombadil.infradead.org>
Date: Thu, 20 Jul 2023 11:13:48 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Shakeel Butt <shakeelb@...gle.com>,
Muchun Song <muchun.song@...ux.dev>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
Yu Zhao <yuzhao@...gle.com>, Kees Cook <keescook@...omium.org>,
Iurii Zaikin <yzaikin@...gle.com>,
"T.J. Mercier" <tjmercier@...gle.com>,
Greg Thelen <gthelen@...gle.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, cgroups@...r.kernel.org
Subject: Re: [RFC PATCH 7/8] memcg: add sysctl and config option to control
memory recharging
On Thu, Jul 20, 2023 at 07:08:24AM +0000, Yosry Ahmed wrote:
> Add a sysctl to enable/disable memory recharging for offline memcgs. Add
> a config option to control whether or not it is enabled by default.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@...gle.com>
> ---
> include/linux/memcontrol.h | 2 ++
> kernel/sysctl.c | 11 +++++++++++
> mm/Kconfig | 12 ++++++++++++
> mm/memcontrol.c | 9 ++++++++-
> 4 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 59b653d4a76e..ae9f09ee90cb 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -60,6 +60,8 @@ struct mem_cgroup_reclaim_cookie {
>
> #ifdef CONFIG_MEMCG
>
> +extern int sysctl_recharge_offline_memcgs;
> +
> #define MEM_CGROUP_ID_SHIFT 16
> #define MEM_CGROUP_ID_MAX USHRT_MAX
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 354a2d294f52..1735d1d95652 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2249,6 +2249,17 @@ static struct ctl_table vm_table[] = {
> .extra2 = (void *)&mmap_rnd_compat_bits_max,
> },
> #endif
> +#ifdef CONFIG_MEMCG
> + {
> + .procname = "recharge_offline_memcgs",
> + .data = &sysctl_recharge_offline_memcgs,
> + .maxlen = sizeof(sysctl_recharge_offline_memcgs),
> + .mode = 0644,
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = SYSCTL_ZERO,
> + .extra2 = SYSCTL_ONE,
> + },
> +#endif /* CONFIG_MEMCG */
> { }
> };
Please don't add any more sysctls to kernel/sysctl.c, git log that file
for a series of cleanups which show how to use your own and why we have
been doing that cleanup.
Luis
Powered by blists - more mailing lists