• Ryan Roberts's avatar
    selftests/mm/khugepaged: enlighten for multi-size THP · 9f0704ea
    Ryan Roberts authored
    The `collapse_max_ptes_none` test was previously failing when a THP size
    less than PMD-size had enabled="always".  The root cause is because the
    test faults in 1 page less than the threshold it set for collapsing.  But
    when THP is enabled always, we "over allocate" and therefore the threshold
    is passed, and collapse unexpectedly succeeds.
    
    Solve this by enlightening khugepaged selftest.  Add a command line option
    to pass in the desired THP size that should be used for all anonymous
    allocations.  The harness will then explicitly configure a THP size as
    requested and modify the `collapse_max_ptes_none` test so that it faults
    in the threshold minus the number of pages in the configured THP size.  If
    no command line option is provided, default to order 0, as per previous
    behaviour.
    
    I chose to use an order in the command line interface, since this makes
    the interface agnostic of base page size, making it easier to invoke from
    run_vmtests.sh.
    
    Link: https://lkml.kernel.org/r/20231207161211.2374093-9-ryan.roberts@arm.com
    
    Signed-off-by: default avatarRyan Roberts <ryan.roberts@arm.com>
    Tested-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
    Tested-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Barry Song <v-songbaohua@oppo.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Itaru Kitayama <itaru.kitayama@gmail.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Yin Fengwei <fengwei.yin@intel.com>
    Cc: Yu Zhao <yuzhao@google.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    9f0704ea
khugepaged.c 31.9 KB