linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: dhowells@redhat.com, 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, linux-block@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] iov_iter: Convert iterate*() to inline funcs
Date: Mon, 14 Aug 2023 14:13:09 +0100	[thread overview]
Message-ID: <4032545.1692018789@warthog.procyon.org.uk> (raw)
In-Reply-To: <CAHk-=whsKN50RfZAP4EL12djwvMiWYKTca_5AYxPnHNzF7ffvg@mail.gmail.com>

Linus Torvalds <torvalds@linux-foundation.org> wrote:

> 
> So I think you need to remove the changes you did to
> memcpy_from_iter(). The old code was an explicit conditional of direct
> calls:
> 
>         if (iov_iter_is_copy_mc(i))
>                 return (void *)copy_mc_to_kernel(to, from, size);
>         return memcpy(to, from, size);
> 
> and now you do that
> 
>                                    iov_iter_is_copy_mc(i) ?
>                                    memcpy_from_iter_mc : memcpy_from_iter);
> 
> to pass in a function pointer.
> 
> Not ok. Not ok at all. It may look clever, but function pointers are
> bad. Avoid them like the plague.

Yeah.  I was hoping that the compiler would manage to inline that, but it just
does an indirect call.  I'm trying to avoid passing the iterator as that makes
things bigger.  I think I can probably share the extra argument used for
passing checksums.

David


  parent reply	other threads:[~2023-08-14 13:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 14:32 [RFC PATCH] iov_iter: Convert iterate*() to inline funcs David Howells
2023-08-11 16:38 ` Linus Torvalds
2023-08-11 17:07 ` David Howells
2023-08-11 18:08   ` Linus Torvalds
2023-08-14 13:13   ` David Howells [this message]
2023-08-14 13:23 ` Matthew Wilcox
2023-08-15 11:12 ` David Laight
2023-08-15 12:51 ` 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=4032545.1692018789@warthog.procyon.org.uk \
    --to=dhowells@redhat.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;
as well as URLs for NNTP newsgroup(s).