public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'David Howells' <dhowells@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Christian Brauner <christian@brauner.io>,
	Matthew Wilcox <willy@infradead.org>,
	"jlayton@kernel.org" <jlayton@kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [RFC PATCH v2] iov_iter: Convert iterate*() to inline funcs
Date: Wed, 16 Aug 2023 08:30:52 +0000	[thread overview]
Message-ID: <8722207799c342e780e1162a983dc48b@AcuMS.aculab.com> (raw)
In-Reply-To: <5247.1692049208@warthog.procyon.org.uk>

From: David Howells
> Sent: 14 August 2023 22:40
> 
> 
> >         _copy_from_iter                          inc 0x36e -> 0x395 +0x27
> 
> Here a disassembly of _copy_from_iter() from unpatched and patched, marked up for
> the different iterator-type branches.  To summarise:
> 
> 		UNPATCHED	PATCHED
> 		START	LEN	START	LEN
> 		=======	=======	=======	=======
> Prologue	0	77	0	76
> UBUF		77	36	76	36
> IOVEC		113	148	112	105
> BVEC		261	159	217	163
> KVEC		420	125	380	116
> XARRAY		545	286	496	374
> DISCARD/Epi	831	42	870	42
> Return		873	-	912	-
> 
> 
> The overall change in the entire file, according to size, is:
>    19855     744       0   20599    5077 build3/lib/iov_iter.o -- before
>    19739     864       0   20603    507b build3/lib/iov_iter.o -- after

It is harder to compare because of some of the random name changes.
The version of the source I found seems to pass priv2 to functions
that don't use it?

Since the functions aren't inlined you get the cost of passing
the parameters.
This seems to affect the common cases.
Is that all left over from a version that passed function pointers
(with the hope they'd be inlined?).
Just directly inlining the simple copies should help.

I rather hope the should_fail_usercopy() and instrument_copy_xxx()
calls are usually either absent or, at most, nops.

This all seems to have a lot fewer options than last time I looked.
Is it worth optimising the KVEC case with a single buffer?

	David

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



  reply	other threads:[~2023-08-16  8:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 21:09 [RFC PATCH v2] iov_iter: Convert iterate*() to inline funcs David Howells
2023-08-14 21:40 ` David Howells
2023-08-16  8:30   ` David Laight [this message]
2023-08-16  9:50     ` David Howells
2023-08-16 10:17       ` David Laight
2023-08-16 11:19         ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8722207799c342e780e1162a983dc48b@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=axboe@kernel.dk \
    --cc=christian@brauner.io \
    --cc=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=jlayton@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox