[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <13a2ce75-b1c0-4930-8911-36ded0b428a7@redhat.com>
Date: Mon, 27 Nov 2023 15:50:46 +0100
From: David Hildenbrand <david@...hat.com>
To: Ryan Roberts <ryan.roberts@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>,
Yin Fengwei <fengwei.yin@...el.com>,
Yu Zhao <yuzhao@...gle.com>,
Catalin Marinas <catalin.marinas@....com>,
Anshuman Khandual <anshuman.khandual@....com>,
Yang Shi <shy828301@...il.com>,
"Huang, Ying" <ying.huang@...el.com>, Zi Yan <ziy@...dia.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Itaru Kitayama <itaru.kitayama@...il.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
John Hubbard <jhubbard@...dia.com>,
David Rientjes <rientjes@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Hugh Dickins <hughd@...gle.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>
Cc: linux-mm@...ck.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH v7 10/10] selftests/mm/cow: Add tests for anonymous
small-sized THP
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@....com>
>> ---
>> 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
Powered by blists - more mailing lists