linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: dhowells@redhat.com,
	Linus Torvalds <torvalds@linux-foundation.org>,
	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 12:19:03 +0100	[thread overview]
Message-ID: <532385.1692184743@warthog.procyon.org.uk> (raw)
In-Reply-To: <a72036d57d50464ea4fe7fa556ee1a72@AcuMS.aculab.com>

David Laight <David.Laight@ACULAB.COM> wrote:

> > That can't be avoided if I convert everything to inline functions and
> > function pointers - but the optimiser can get rid of it where it can
> > inline the step function.
> 
> AFAICT the IOVEC one was only called directly.

I've made some changes that I'll post shortly, and I now get this:

	...
	<+36>:	cmpb   $0x0,0x1(%rdx)	# iter->copy_mc
	...
	<+46>:	je     0xffffffff81779aae <_copy_from_iter+98>
	<+48>:	jmp    0xffffffff81779a87 <_copy_from_iter+59>
	...
	# Handle ->copy_mc == true
	<+59>:	mov    0x38(%rsp),%rax
	<+64>:	sub    %gs:0x28,%rax
	<+73>:	jne    0xffffffff81779db1 <_copy_from_iter+869>
	<+79>:	add    $0x40,%rsp
	<+83>:	pop    %rbx
	<+84>:	pop    %rbp
	<+85>:	pop    %r12
	<+87>:	pop    %r13
	<+89>:	pop    %r14
	<+91>:	pop    %r15
	<+93>:	jmp    0xffffffff81777934 <__copy_from_iter_mc>
	...
	# ITER_UBUF
	<+121>:	mov    (%rdx),%al
	<+123>:	cmp    $0x5,%al
	<+125>:	jne    0xffffffff81779b01 <_copy_from_iter+181>
	...
	<+147>:	call   0xffffffff817777ee <__access_ok>
	<+152>:	test   %al,%al
	<+154>:	je     0xffffffff81779af9 <_copy_from_iter+173>
	<+156>:	nop
	<+157>:	nop
	<+158>:	nop
	<+159>:	mov    %r12,%rdi
	<+162>:	mov    %rdx,%rsi
	<+165>:	rep movsb %ds:(%rsi),%es:(%rdi)
	...
	# ITER_IOVEC
	<+181>:	test   %al,%al
	<+183>:	jne    0xffffffff81779b8d <_copy_from_iter+321>
	...
	<+234>:	call   0xffffffff817777ee <__access_ok>
	<+239>:	test   %al,%al
	<+241>:	je     0xffffffff81779b54 <_copy_from_iter+264>
	<+243>:	nop
	<+244>:	nop
	<+245>:	nop
	<+246>:	lea    (%r12,%r15,1),%rax
	<+250>:	mov    %r8,%rsi
	<+253>:	mov    %rax,%rdi
	<+256>:	rep movsb %ds:(%rsi),%es:(%rdi)
	...
	# ITER_BVEC
	<+321>:	cmp    $0x2,%al
	<+323>:	jne    0xffffffff81779c1f <_copy_from_iter+467>
	...
	<+375>:	call   0xffffffff81777282 <kmap_local_page>
	...
	<+431>:	rep movsb %ds:(%rsi),%es:(%rdi)
	...
	# ITER_KVEC
	<+467>:	cmp    $0x1,%al
	<+469>:	jne    0xffffffff81779c82 <_copy_from_iter+566>
	...
	<+526>:	rep movsb %ds:(%rsi),%es:(%rdi)
	...
	# ITER_XARRAY
	<+566>:	cmp    $0x3,%al
	<+568>:	jne    0xffffffff81779d9d <_copy_from_iter+849>
	...
	<+639>:	call   0xffffffff81126bcf <__rcu_read_lock>
	...
	<+651>:	call   0xffffffff81d5ed97 <xas_find>
	...
	<+764>:	call   0xffffffff817772a7 <kmap_local_folio>
	...
	<+806>:	rep movsb %ds:(%rsi),%es:(%rdi)
	...
	# ITER_DISCARD/default
	<+849>:	sub    %rbx,0x18(%rbp)
	<+853>:	mov    0x38(%rsp),%rax
	<+858>:	sub    %gs:0x28,%rax
	<+867>:	je     0xffffffff81779db6 <_copy_from_iter+874>
	<+869>:	call   0xffffffff81d6578c <__stack_chk_fail>
	<+874>:	add    $0x40,%rsp
	<+878>:	mov    %rbx,%rax
	<+881>:	pop    %rbx
	<+882>:	pop    %rbp
	<+883>:	pop    %r12
	<+885>:	pop    %r13
	<+887>:	pop    %r14
	<+889>:	pop    %r15
	<+891>:	jmp    0xffffffff81d72920 <__x86_return_thunk>

David



      parent reply	other threads:[~2023-08-16 11:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 21:09 David Howells
2023-08-14 21:40 ` David Howells
2023-08-16  8:30   ` David Laight
2023-08-16  9:50   ` David Howells
2023-08-16 10:17     ` David Laight
2023-08-16 11:19     ` David Howells [this message]

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=532385.1692184743@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=axboe@kernel.dk \
    --cc=christian@brauner.io \
    --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