Re: [PATCH] memcg: add interface to force disable swap

From: Huang, Ying
Date: Sat Oct 07 2023 - 21:17:12 EST


Jianlin Lv <iecedge@xxxxxxxxx> writes:

> From: Jianlin Lv <iecedge@xxxxxxxxx>
>
> Global reclaim will swap even if swappiness is set to 0.

Why? Can you elaborate the situation?

> In particular
> case, users wish to be able to completely disable swap for specific
> processes. One scenario is that if JVM memory pages falls into swap,
> the performance will noticeably reduce and the GC pauses tend to increase
> to levels not tolerable by most applications.
> If it's possible to only disable swap out for specific processes, it can
> address the JVM GC pauses issues, and at the same time, memory reclaim
> pressure is also manageable.
>
> This patch adds "memory.swap_force_disable" control file to support disable
> swap for non-root cgroup. When process is associated with a cgroup,
> 'echo 1 > memory.swap_force_disable' will forbid anon pages be swapped out.
> This patch also adds read and write handler of the control file.

--
Best Regards,
Huang, Ying