[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88976a40175c491fb5e3349f6686ad67@AcuMS.aculab.com>
Date: Mon, 13 Sep 2021 16:03:09 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Willy Tarreau' <w@....eu>, Douglas Gilbert <dgilbert@...erlog.com>
CC: LKML <linux-kernel@...r.kernel.org>
Subject: RE: how many memset(,0,) calls in kernel ?
> 36: b9 06 00 00 00 mov $0x6,%ecx
> 3b: 4c 89 e7 mov %r12,%rdi
> 3e: f3 ab rep stos %eax,%es:(%rdi)
>
> The last line does exactly "memset(%rdi, %eax, %ecx)". Just two bytes
> for some code that modern processors are even able to optimize.
Hmmm I'd bet that 6 stores will be faster on ~everything.
'modern' processors do better than some older ones [1], but 6
writes isn't enough to get into the really fast paths.
So you'll still take a few cycles of setup.
[1] P4 netburst had a ~40 clock setup for any 'rep' operation.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists