Thread (34 messages) 34 messages, 7 authors, 2025-08-15

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

From: Zi Yan <ziy@nvidia.com>
Date: 2025-08-14 15:53:04
Also in: linux-fsdevel, linux-mm, lkml

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 <redacted>
Signed-off-by: Usama Arif <redacted>
---
 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>
quoted hunk ↗ jump to hunk
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 [off-list ref]

Best Regards,
Yan, Zi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help