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  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]
Date:   Mon, 11 Jan 2021 10:11:17 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Matthew Wilcox' <>,
        Mikulas Patocka <>
CC:     Andrew Morton <>,
        Dan Williams <>,
        Vishal Verma <>,
        "Dave Jiang" <>,
        Ira Weiny <>, Jan Kara <>,
        Steven Whitehouse <>,
        Eric Sandeen <>,
        Dave Chinner <>,
        Theodore Ts'o <>,
        Wang Jianchao <>,
        "Kani, Toshi" <>,
        "Norton, Scott J" <>,
        "Tadakamadla, Rajesh" <>,
        "" <>,
        "" <>,
        "" <>
Subject: RE: Expense of read_iter

From: Matthew Wilcox
> Sent: 10 January 2021 06:13
> nvfs_rw_iter_locked() looks very complicated.  I suspect it can
> be simplified.  Of course new_sync_read() needs to be improved too,
> as do the other functions here, but fully a third of the difference
> between read() and read_iter() is the difference between nvfs_read()
> and nvfs_rw_iter_locked().

There is also the non-zero cost of import_iovec().
I've got some slight speedups, but haven't measured an
old kernel yet to see how much slower 5.11-rc1 made it.

Basic test is:
	fd = open("/dev/null", O_RDWR);
	for (1 = 0; 1 < 10000; i++) {
		start = rdtsc();
		writev(fd, iovec, count);
		histogram[rdtsc() - start]++;

This doesn't actually copy any data - the iovec
isn't iterated.

I'm seeing pretty stable counts for most of the 10000 iterations.
But different program runs can give massively different timings.
I'm quessing that depends on cache collisions due to the addresses
(virtual of physical?) selected for some items.

For 5.11-rc2 -mx32 is slightly faster than 64bit.
Whereas -m32 has a much slower syscall entry/exit path,
but the difference between gettid() and writev() is lower.
The compat code for import_iovec() is actually faster.
This isn't really surprising since copy_from_user() is
absolutely horrid these days - especially with userspace hardening.


Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists