linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Pavel Begunkov <asml.silence@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [git pull] iov_iter fixes
Date: Fri, 10 Sep 2021 03:27:54 +0000	[thread overview]
Message-ID: <YTrQuvqvJHd9IObe@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk>

On Thu, Sep 09, 2021 at 09:22:30PM -0600, Jens Axboe wrote:
> On 9/9/21 9:11 PM, Al Viro wrote:
> > On Thu, Sep 09, 2021 at 09:05:13PM -0600, Jens Axboe wrote:
> >> On 9/9/21 8:57 PM, Al Viro wrote:
> >>> On Thu, Sep 09, 2021 at 03:19:56PM -0600, Jens Axboe wrote:
> >>>
> >>>> Not sure how we'd do that, outside of stupid tricks like copy the
> >>>> iov_iter before we pass it down. But that's obviously not going to be
> >>>> very efficient. Hence we're left with having some way to reset/reexpand,
> >>>> even in the presence of someone having done truncate on it.
> >>>
> >>> "Obviously" why, exactly?  It's not that large a structure; it's not
> >>> the optimal variant, but I'd like to see profiling data before assuming
> >>> that it'll cause noticable slowdowns.
> >>
> >> It's 48 bytes, and we have to do it upfront. That means we'd be doing it
> >> for _all_ requests, not just when we need to retry. As an example, current
> >> benchmarks are at ~4M read requests per core. That'd add ~200MB/sec of
> >> memory traffic just doing this copy.
> > 
> > Umm...  How much of that will be handled by cache?
> 
> Depends? And what if the iovec itself has been modified in the middle?
> We'd need to copy that whole thing too. It's just not workable as a
> solution.

Huh?  Why the hell would we need to copy iovecs themselves?  They are never
modified by ->read_iter()/->write_iter().

That's the whole fucking point of iov_iter - the iovec itself is made
constant, with all movable parts taken to iov_iter.

Again, we should never, ever modify the iovec (or bvec, etc.) array in
->read_iter()/->write_iter()/->sendmsg()/etc. instances.  If you see such
behaviour anywhere, report it immediately.  Any such is a blatant bug.

  reply	other threads:[~2021-09-10  3:27 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  4:22 [git pull] iov_iter fixes Al Viro
2021-09-09 19:37 ` Linus Torvalds
2021-09-09 21:19   ` Jens Axboe
2021-09-09 21:39     ` Jens Axboe
2021-09-09 21:56       ` Linus Torvalds
2021-09-09 22:21         ` Jens Axboe
2021-09-09 22:56           ` Linus Torvalds
2021-09-10  1:35             ` Jens Axboe
2021-09-10  2:43               ` Jens Axboe
2021-09-10  2:48               ` Al Viro
2021-09-10  3:06                 ` Jens Axboe
2021-09-10  3:15                   ` Al Viro
2021-09-10  3:23                     ` Jens Axboe
2021-09-10  3:24                     ` Al Viro
2021-09-10  3:28                       ` Jens Axboe
2021-09-13 15:29                 ` David Laight
2021-09-09 21:42     ` Dave Chinner
2021-09-10  2:57     ` Al Viro
2021-09-10  3:05       ` Jens Axboe
2021-09-10  3:11         ` Al Viro
2021-09-10  3:22           ` Jens Axboe
2021-09-10  3:27             ` Al Viro [this message]
2021-09-10  3:30               ` Jens Axboe
2021-09-10  3:36                 ` Al Viro
2021-09-10 13:57                   ` Jens Axboe
2021-09-10 14:42                     ` Al Viro
2021-09-10 15:08                       ` Jens Axboe
2021-09-10 15:32                         ` Al Viro
2021-09-10 15:36                           ` Jens Axboe
2021-09-10 15:04                     ` Jens Axboe
2021-09-10 16:06                       ` Jens Axboe
2021-09-10 16:44                         ` Linus Torvalds
2021-09-10 16:56                         ` Al Viro
2021-09-10 16:58                           ` Linus Torvalds
2021-09-10 17:26                             ` Jens Axboe
2021-09-10 17:31                               ` Linus Torvalds
2021-09-10 17:32                                 ` Jens Axboe
2021-09-10 18:48                                 ` Al Viro
2021-09-10 19:04                                   ` Linus Torvalds
2021-09-10 19:10                                     ` Linus Torvalds
2021-09-10 19:10                                   ` Jens Axboe
2021-09-10 17:04                           ` Jens Axboe
2021-09-09 22:54   ` Pavel Begunkov
2021-09-09 22:57     ` Pavel Begunkov
2021-09-09 23:14   ` Pavel Begunkov
2021-09-09 20:03 ` pr-tracker-bot

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=YTrQuvqvJHd9IObe@zeniv-ca.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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).