[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6A8E4E50-88AD-482F-811C-8707027B1E1C@nvidia.com>
Date: Thu, 07 Aug 2025 13:00:04 -0400
From: Zi Yan <ziy@...dia.com>
To: wang lian <lianux.mm@...il.com>
Cc: Liam.Howlett@...cle.com, akpm@...ux-foundation.org, baohua@...nel.org,
baolin.wang@...ux.alibaba.com, david@...hat.com, dev.jain@....com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-mm@...ck.org, lorenzo.stoakes@...cle.com, mhocko@...e.com,
npache@...hat.com, rppt@...nel.org, ryan.roberts@....com, shuah@...nel.org,
surenb@...gle.com, vbabka@...e.cz
Subject: Re: [PATCH 3/4] selftests/mm: add check_folio_orders() helper.
On 6 Aug 2025, at 23:00, wang lian wrote:
> Hi Zi,
>
> Thanks for the patch.
>
> I have a nit suggestion to centralize some of the macro definitions
> for better consistency and reusability.
>
> On [Date of patch], Zi Yan wrote:
>> diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c
>> ...
>> +#define PGMAP_PRESENT (1UL << 63)
>> +#define KPF_COMPOUND_HEAD (1UL << 15)
>> +#define KPF_COMPOUND_TAIL (1UL << 16)
>> +#define KPF_THP (1UL << 22)
>> +#define PFN_MASK ((1UL<<55)-1)
>
> Currently, these macros and `PGMAP_PRESENT` are defined locally in
> `vm_util.c`. It would be cleaner to move them to the shared header
> `vm_util.h`.
>
> This would also allow us to consistently use `PM_PRESENT` (from the
> header) instead of the local `PGMAP_PRESENT` duplicate. I noticed the
> patch is already moving in this direction, and we can complete this
> cleanup.
>
> How about a change like this?
I did not know about PM_PRESENT. Sure, will move the code like you
did below. Thanks.
>
> --- a/tools/testing/selftests/mm/vm_util.c
> +++ b/tools/testing/selftests/mm/vm_util.c
> @@ -17,17 +17,6 @@
> #define STATUS_FILE_PATH "/proc/self/status"
> #define MAX_LINE_LENGTH 500
>
> -#define PGMAP_PRESENT (1UL << 63)
> -#define KPF_COMPOUND_HEAD (1UL << 15)
> -#define KPF_COMPOUND_TAIL (1UL << 16)
> -#define KPF_THP (1UL << 22)
> -#define PFN_MASK ((1UL<<55)-1)
> -
> unsigned int __page_size;
> unsigned int __page_shift;
>
> @@ -360,7 +349,7 @@ static int get_page_flags(uint64_t vpn, int pagemap_file, int kpageflags_file,
> * Treat non-present page as a page without any flag, so that
> * gather_folio_orders() just record the current folio order.
> */
> - if (!(pfn & PGMAP_PRESENT)) {
> + if (!(pfn & PM_PRESENT)) {
> *flags = 0;
> return 0;
> }
> --- a/tools/testing/selftests/mm/vm_util.h
> +++ b/tools/testing/selftests/mm/vm_util.h
> @@ -17,6 +17,11 @@
> #define PM_FILE BIT_ULL(61)
> #define PM_SWAP BIT_ULL(62)
> #define PM_PRESENT BIT_ULL(63)
> +#define KPF_COMPOUND_HEAD (1UL << 15)
> +#define KPF_COMPOUND_TAIL (1UL << 16)
> +#define KPF_THP (1UL << 22)
> +#define PFN_MASK ((1UL<<55)-1)
>
> extern unsigned int __page_size;
> extern unsigned int __page_shift;
>
>
> Best regards,
> wang lian
--
Best Regards,
Yan, Zi
Powered by blists - more mailing lists