Re: [PATCH v4 5/7] selftest/mm: Extract sz2ord function into vm_util.h

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

 



On 13 Aug 2025, at 9:55, Usama Arif wrote:

> The function already has 2 uses and will have a 3rd one
> in prctl selftests. The pagesize argument is added into
> the function, as it's not a global variable anymore.
> No functional change intended with this patch.
>
> Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> Signed-off-by: Usama Arif <usamaarif642@xxxxxxxxx>
> ---
>  tools/testing/selftests/mm/cow.c            | 12 ++++--------
>  tools/testing/selftests/mm/uffd-wp-mremap.c |  9 ++-------
>  tools/testing/selftests/mm/vm_util.h        |  5 +++++
>  3 files changed, 11 insertions(+), 15 deletions(-)
>

<snip>

> diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h
> index 148b792cff0fc..e5cb72bf3a2ab 100644
> --- a/tools/testing/selftests/mm/vm_util.h
> +++ b/tools/testing/selftests/mm/vm_util.h
> @@ -135,6 +135,11 @@ static inline void log_test_result(int result)
>  	ksft_test_result_report(result, "%s\n", test_name);
>  }
>
> +static inline int sz2ord(size_t size, size_t pagesize)
> +{
> +	return __builtin_ctzll(size / pagesize);
> +}
> +

There is a psize() at the top of vm_util.h to get pagesize.
But I have no strong opinion on passing pagesize or not.

Anyway, Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>

Best Regards,
Yan, Zi





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux