Re: [PATCH mm-unstable v4 05/10] selftests/vm: dedup THP helpers
From: Zi Yan <ziy@nvidia.com>
Date: 2022-09-27 15:34:45
Also in:
linux-mm
On 22 Sep 2022, at 18:40, Zach O'Keefe wrote:
These files: tools/testing/selftests/vm/vm_util.c tools/testing/selftests/vm/khugepaged.c Both contain logic to: 1) Determine hugepage size on current system 2) Read /proc/self/smaps to determine number of THPs at an address Refactor selftests/vm/khugepaged.c to use the vm_util common helpers and add it as a build dependency. Since selftests/vm/khugepaged.c is the largest user of check_huge(), change the signature of check_huge() to match selftests/vm/khugepaged.c's useage: take an expected number of hugepages, and return a bool indicating if the correct number of hugepages were found. Add a wrapper, check_huge_anon(), in anticipation of checking smaps for file and shmem hugepages. Update existing callsites to use the new pattern / function. Likewise, check_for_pattern() was duplicated, and it's a general enough helper to include in vm_util helpers as well. Link: https://lkml.kernel.org/r/20220907144521.3115321-6-zokeefe@google.com Signed-off-by: Zach O'Keefe <redacted> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Chris Kennelly <redacted> Cc: David Hildenbrand <redacted> Cc: David Rientjes <rientjes@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: James Houghton <redacted> Cc: "Kirill A. Shutemov" <redacted> Cc: Matthew Wilcox <willy@infradead.org> Cc: Miaohe Lin <linmiaohe@huawei.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Pasha Tatashin <pasha.tatashin@soleen.com> Cc: Peter Xu <peterx@redhat.com> Cc: Rongwei Wang <redacted> Cc: SeongJae Park <sj@kernel.org> Cc: Song Liu <redacted> Cc: Vlastimil Babka <redacted> Cc: Yang Shi <redacted> --- tools/testing/selftests/vm/Makefile | 1 + tools/testing/selftests/vm/khugepaged.c | 64 ++----------------- tools/testing/selftests/vm/soft-dirty.c | 2 +- .../selftests/vm/split_huge_page_test.c | 12 ++-- tools/testing/selftests/vm/vm_util.c | 26 +++++--- tools/testing/selftests/vm/vm_util.h | 3 +- 6 files changed, 32 insertions(+), 76 deletions(-)
LGTM. Thanks. Reviewed-by: Zi Yan [off-list ref] -- Best Regards, Yan, Zi
Attachments
- signature.asc [application/pgp-signature] 854 bytes