summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin
diff options
context:
space:
mode:
authorHongfu Li <lihongfu@kylinos.cn>2026-07-13 11:32:09 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-08-06 18:56:56 -0700
commit824d80962cf277f1c02e781bb18684b588111612 (patch)
treeabdc46841cd8188e2aa9015e9fdb5aaf722f3248 /tools/perf/scripts/python/bin
parent4f93f0956f446e270222c58f821de7500a163229 (diff)
selftests/mm: factor out hmm_buffer_alloc() to consolidate buffer setup
Each HMM test open-codes the same buffer initialization sequence: allocate main buffer, assign file descriptor and size, allocate mirror buffer, then perform mmap mapping. Factor out this repeated logic into a standalone hmm_buffer_alloc() helper to eliminate ~35 open-coded copies. The new helper supports distinct mmap_size and mirror_size parameters to fit scenarios with THP alignment padding or per-page snapshot flags. It also exposes prot, flags and fd arguments, enabling support for MAP_SHARED, MAP_HUGETLB and file-backed mappings. Eliminates ~360 lines of redundant boilerplate code. Fixes a missing NULL pointer check bug in the hmm_buffer_alloc() previously used only by the migration benchmark, now subsumed by this new unified helper. Link: https://lore.kernel.org/20260713033209.280435-1-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Cc: David Hildenbrand <david@kernel.org> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@kernel.org> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions