lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <08e4a7fc-bd06-4c8c-96e2-84991c4ce891@gmail.com>
Date: Mon, 17 Feb 2025 18:00:22 +0000
From: "Colin King (gmail)" <colin.i.king@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
 kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] mm/mincore: improve performance by adding an
 unlikely hint

fOn 17/02/2025 17:58, Matthew Wilcox wrote:
> On Mon, Feb 17, 2025 at 05:09:34PM +0000, Colin Ian King wrote:
>> 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.
>>
>> 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.
> 
> I think you've elided _just_ enough information here that nobody can
> judge whether your stats skills are any good ;-)  You've told us 7ns
> (per call, presumably) and you've told us 0.10% standard deviation,
> but you haven't told us how long the syscall takes, so nobody can tell
> whether 7ns is within 0.10% or not ;-)

Ugh, my bad.

Improvement was from ~970 down to 963 ns, so small ~0.7% improvement.

Colin

> 
>> Signed-off-by: Colin Ian King <colin.i.king@...il.com>
>> ---
>>   mm/mincore.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/mincore.c b/mm/mincore.c
>> index d6bd19e520fc..832f29f46767 100644
>> --- a/mm/mincore.c
>> +++ b/mm/mincore.c
>> @@ -239,7 +239,7 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
>>   	start = untagged_addr(start);
>>   
>>   	/* Check the start address: needs to be page-aligned.. */
>> -	if (start & ~PAGE_MASK)
>> +	if (unlikely(start & ~PAGE_MASK))
>>   		return -EINVAL;
> 
> We might get even more advantage by moving the EINVAL test before
> untagged_addr() since we know that the tags are all in the high bits and
> we don't need to have the test be dependent on the previous arithmetic.


Download attachment "OpenPGP_0x68C287DFC6A80226.asc" of type "application/pgp-keys" (4825 bytes)

Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ