Re: [patch] mm, thp: track fallbacks due to failed memcg charges separately

From: Kirill A. Shutemov
Date: Tue Feb 18 2020 - 03:26:12 EST

On Mon, Feb 17, 2020 at 09:41:40PM -0800, David Rientjes wrote:
> The thp_fault_fallback stat in either /proc/vmstat is incremented if
> either the hugepage allocation fails through the page allocator or the
> hugepage charge fails through mem cgroup.
> This patch leaves this field untouched but adds a new field,
> thp_fault_fallback_charge, which is incremented only when the mem cgroup
> charge fails.
> This distinguishes between faults that want to be backed by hugepages but
> fail due to fragmentation (or low memory conditions) and those that fail
> due to mem cgroup limits. That can be used to determine the impact of
> fragmentation on the system by excluding faults that failed due to memcg
> usage.
> Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>

The patch looks good to me, but I noticed that we miss THP_FAULT_FALLBACK
(and THP_FAULT_FALLBACK_CHARGE) accounting in shmem_getpage_gfp().

Could you fix this while you are there?
Kirill A. Shutemov