Re: [RESEND PATCH v7 10/10] selftests/mm/cow: Add tests for anonymous small-sized THP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27.11.23 15:02, Ryan Roberts wrote:
On 22/11/2023 16:29, Ryan Roberts wrote:
Add tests similar to the existing PMD-sized THP tests, but which operate
on memory backed by (PTE-mapped) small-sized THP. This reuses all the
existing infrastructure. If the test suite detects that small-sized THP
is not supported by the kernel, the new tests are skipped.

Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
---
  tools/testing/selftests/mm/cow.c | 71 +++++++++++++++++++++++++++++++-
  1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index d03c453cfd5c..3efc395c7077 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -29,15 +29,49 @@
  #include "../../../../mm/gup_test.h"
  #include "../kselftest.h"
  #include "vm_util.h"
+#include "thp_settings.h"

  static size_t pagesize;
  static int pagemap_fd;
  static size_t pmdsize;
+static int nr_thpsmallsizes;
+static size_t thpsmallsizes[20];

Off the back of some comments David made againt the previous patch [1], I'm
proposing to rework this a bit so that ALL thp sizes are stored in this array,
not just the non-PMD-sized sizes. This makes the changes overall a bit smaller
and easier to understand, I think...

  static int nr_hugetlbsizes;
  static size_t hugetlbsizes[10];
  static int gup_fd;
  static bool has_huge_zeropage;

+static int sz2ord(size_t size)
+{
+	return __builtin_ctzll(size / pagesize);
+}
+
+static int detect_smallthp_sizes(size_t sizes[], int max)

This changes to detect_thp_sizes() and deposits all sizes in sizes[]

Just what I wanted to propose :) Makes it simpler by removing the "small" terminology and just detecting thp sizes.

--
Cheers,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux