]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mincore: improve performance by adding an unlikely hint
authorColin Ian King <colin.i.king@gmail.com>
Wed, 19 Feb 2025 08:36:07 +0000 (08:36 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Feb 2025 01:00:21 +0000 (17:00 -0800)
commite93308070ee0a44511dae92bb1566ec25a95a5bb
treedcdc5492277fb7fbed8c23b96b1f8b95b345f9e4
parentd0508ec5953206623982d0abb1e3c60f31e310bb
mm/mincore: improve performance by adding an unlikely hint

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.

Link: https://lkml.kernel.org/r/20250219083607.5183-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Cc: Matthew Wilcow <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mincore.c