• Barry Song's avatar
    mm: add per-order mTHP anon_fault_alloc and anon_fault_fallback counters · ec33687c
    Barry Song authored
    Patch series "mm: add per-order mTHP alloc and swpout counters", v6.
    
    The patchset introduces a framework to facilitate mTHP counters, starting
    with the allocation and swap-out counters.  Currently, only four new nodes
    are appended to the stats directory for each mTHP size.
    
    /sys/kernel/mm/transparent_hugepage/hugepages-<size>/stats
    	anon_fault_alloc
    	anon_fault_fallback
    	anon_fault_fallback_charge
    	anon_swpout
    	anon_swpout_fallback
    
    These nodes are crucial for us to monitor the fragmentation levels of both
    the buddy system and the swap partitions.  In the future, we may consider
    adding additional nodes for further insights.
    
    
    This patch (of 4):
    
    Profiling a system blindly with mTHP has become challenging due to the
    lack of visibility into its operations.  Presenting the success rate of
    mTHP allocations appears to be pressing need.
    
    Recently, I've been experiencing significant difficulty debugging
    performance improvements and regressions without these figures.  It's
    crucial for us to understand the true effectiveness of mTHP in real-world
    scenarios, especially in systems with fragmented memory.
    
    This patch establishes the framework for per-order mTHP counters.  It
    begins by introducing the anon_fault_alloc and anon_fault_fallback
    counters.  Additionally, to maintain consistency with
    thp_fault_fallback_charge in /proc/vmstat, this patch also tracks
    anon_fault_fallback_charge when mem_cgroup_charge fails for mTHP. 
    Incorporating additional counters should now be straightforward as well.
    
    Link: https://lkml.kernel.org/r/20240412114858.407208-1-21cnbao@gmail.com
    Link: https://lkml.kernel.org/r/20240412114858.407208-2-21cnbao@gmail.comSigned-off-by: default avatarBarry Song <v-songbaohua@oppo.com>
    Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Chris Li <chrisl@kernel.org>
    Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
    Cc: Kairui Song <kasong@tencent.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Yosry Ahmed <yosryahmed@google.com>
    Cc: Yu Zhao <yuzhao@google.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    ec33687c
huge_memory.c 99.7 KB