Re: [PATCH] mm, memcg: Add memory.transparent_hugepage_disabled

From: Chris Down
Date: Tue Mar 24 2020 - 09:24:01 EST


Hui Zhu writes:
/sys/kernel/mm/transparent_hugepage/enabled is the only interface to
control if the application can use THP in system level.
Sometime, we would not want an application use THP even if
transparent_hugepage/enabled is set to "always" or "madvise" because
thp may need more cpu and memory resources in some cases.

This commit add a new interface memory.transparent_hugepage_disabled
in memcg.
When it set to 1, the application inside the cgroup cannot use THP
except dax.

I'm against this patch even in the abstract -- this adds an extremely niche use case to a general interface, and there are plenty of ways to already indicate THP preference.

Perhaps there is some new interface desirable for your use case, but adding a new global file to memcg certainly isn't it.