lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <edbqzi3hqfvkr36pawvjkrogjmjzxnhs5fcbye4oacyxye2s4h@vwq4ic7xzjoc>
Date: Wed, 19 Mar 2025 12:29:11 -0700
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: Jingxiang Zeng <linuszeng@...cent.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org, cgroups@...r.kernel.org, 
	linux-kernel@...r.kernel.org, hannes@...xchg.org, mhocko@...nel.org, roman.gushchin@...ux.dev, 
	muchun.song@...ux.dev, kasong@...cent.com
Subject: Re: [RFC 1/5] Kconfig: add SWAP_CHARGE_V1_MODE config

On Wed, Mar 19, 2025 at 02:41:44PM +0800, Jingxiang Zeng wrote:
> From: Zeng Jingxiang <linuszeng@...cent.com>
> 
> Added SWAP_CHARGE_V1_MODE config, which is disabled by default.
> When enabled in cgroupv2 mode, the memory accounting method of
> swap will be restored to cgroupv1 mode.
> 
> Signed-off-by: Zeng Jingxiang <linuszeng@...cent.com>
> ---
>  include/linux/memcontrol.h |  6 ++++++
>  init/Kconfig               | 16 ++++++++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 53364526d877..dcb087ee6e8d 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -62,6 +62,12 @@ struct mem_cgroup_reclaim_cookie {
>  
>  #ifdef CONFIG_MEMCG
>  
> +/* Whether enable memory+swap account in cgroupv2 */
> +static inline bool do_memsw_account_on_dfl(void)
> +{
> +	return IS_ENABLED(CONFIG_MEMSW_ACCOUNT_ON_DFL);
> +}
> +

Please move the above to memcontrol-v1.h file.

>  #define MEM_CGROUP_ID_SHIFT	16
>  
>  struct mem_cgroup_id {
> diff --git a/init/Kconfig b/init/Kconfig
> index 7f67d8942a09..669e39214244 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1012,6 +1012,22 @@ config MEMCG_V1
>  
>  	  Say N if unsure.
>  
> +config MEMSW_ACCOUNT_ON_DFL
> +	bool "Whether enable memory+swap account in cgroup v2"
> +	depends on MEMCG && MEMCG_V1
> +	default n
> +	help
> +	  Say Y here to enable memory+swap account in cgroup v2. Enabling this
> +	  option means that the semantics of memory.swap.max will align with
> +	  memory.memsw.limit_in_bytes, and memory.swap.current will align with
> +	  memory.memsw.usage_in_bytes.
> +	  This is particularly useful for workloads that require strict memory
> +	  and swap limits.
> +
> +	  If you are unsure whether to enable this option, it is recommended
> +	  to leave it disabled (N) unless you specifically need memory and swap
> +	  accounting features in your cgroup v2 setup.
> +
>  config BLK_CGROUP
>  	bool "IO controller"
>  	depends on BLOCK
> -- 
> 2.41.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ