Skip to contentSkip to conversation

mm-mincore-improve-performance-by-adding-an-unlikely-hint.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 17, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/mincore: improve performance by adding an unlikely hint
has been removed from the -mm tree. Its filename was
mm-mincore-improve-performance-by-adding-an-unlikely-hint.patch

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

------------------------------------------------------
From: Colin Ian King <[email protected]>
Subject: mm/mincore: improve performance by adding an unlikely hint
Date: Wed, 19 Feb 2025 08:36:07 +0000

Adding an unlikely() hint on the masked start comparison error return path improves run-time performance of the mincore system call.

Benchmarking on an i9-12900 shows an improvement of 7ns on mincore calls on a 256KB mmap'd region where 50% of the pages we resident. Improvement was from ~970 ns down to 963 ns, so a small ~0.7% improvement.

Results based on running 20 tests with turbo disabled (to reduce clock freq turbo changes), with 10 second run per test and comparing the number of mincores calls per second. The % standard deviation of the 20 tests was ~0.10%, so results are reliable.

---

 mm/mincore.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mincore.c renamed from mm/mincore.c~mm-mincore-improve-performance-by-adding-an-unlikely-hint +1 -1
@@ -239,7 +239,7 @@ SYSCALL_DEFINE3(mincore, unsigned long,
 	start = untagged_addr(start);
 
 	/* Check the start address: needs to be page-aligned.. */
-	if (start & ~PAGE_MASK)
+	if (unlikely(start & ~PAGE_MASK))
 		return -EINVAL;
 
 	/* ..and we need to be passed a valid user-space range */

_

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