Skip to contentSkip to conversation

lib-test_mul_u64_u64_div_u64-test-both-generic-and-arch-versions.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Nov 20, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: lib: test_mul_u64_u64_div_u64(): test both generic and arch versions
has been removed from the -mm tree. Its filename was

     lib-test_mul_u64_u64_div_u64-test-both-generic-and-arch-versions.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: David Laight <[email protected]>
Subject: lib: test_mul_u64_u64_div_u64(): test both generic and arch versions
Date: Wed, 5 Nov 2025 20:10:32 +0000

Change the #if in div64.c so that test_mul_u64_u64_div_u64.c can compile and test the generic version (including the 'long multiply') on architectures (eg amd64) that define their own copy.

Test the kernel version and the locally compiled version on all arch. Output the time taken (in ns) on the 'test completed' trace.

For reference, on my zen 5, the optimised version takes ~220ns and the generic version ~3350ns. Using the native multiply saves ~200ns and adding back the ilog2() 'optimisation' test adds ~50ms.

Cc Biju Das <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Li RongQing <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleinxer <[email protected]>
Cc Uwe Kleine-König <[email protected]>

---

 lib/math/div64.c                    |    8 +++-
 lib/math/test_mul_u64_u64_div_u64.c |   52 ++++++++++++++++++++++----
 2 files changed, 51 insertions(+), 9 deletions(-)
lib/math/div64.c renamed from lib/math/div64.c~lib-test_mul_u64_u64_div_u64-test-both-generic-and-arch-versions +6 -2
@@ -177,16 +177,18 @@ EXPORT_SYMBOL(div64_s64);
  * Iterative div/mod for use when dividend is not expected to be much
  * bigger than divisor.
  */
+#ifndef iter_div_u64_rem
 u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
 {
 	return __iter_div_u64_rem(dividend, divisor, remainder);
 }
 EXPORT_SYMBOL(iter_div_u64_rem);
+#endif
 
-#ifndef mul_u64_add_u64_div_u64
+#if !defined(mul_u64_add_u64_div_u64) || defined(test_mul_u64_add_u64_div_u64)
 u64 mul_u64_add_u64_div_u64(u64 a, u64 b, u64 c, u64 d)
 {
-#if defined(__SIZEOF_INT128__)
+#if defined(__SIZEOF_INT128__) && !defined(test_mul_u64_add_u64_div_u64)
 
 	/* native 64x64=128 bits multiplication */
 	u128 prod = (u128)a * b + c;
@@ -267,5 +269,7 @@ u64 mul_u64_add_u64_div_u64(u64 a, u64 b
 
 	return res;
 }
+#if !defined(test_mul_u64_add_u64_div_u64)
 EXPORT_SYMBOL(mul_u64_add_u64_div_u64);
 #endif
+#endif
lib/math/test_mul_u64_u64_div_u64.c renamed from lib/math/test_mul_u64_u64_div_u64.c~lib-test_mul_u64_u64_div_u64-test-both-generic-and-arch-versions +45 -7

81 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are