From: Gerd Hoffmann <kraxel@redhat.com>
To: Petr Baudis <pasky@suse.cz>
Cc: Ulrich Drepper <drepper@redhat.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-api@vger.kernel.org, aarcange@redhat.com
Subject: Re: [PATCH v6 0/5] Add preadv & pwritev system calls.
Date: Wed, 21 Jan 2009 10:31:27 +0100 [thread overview]
Message-ID: <4976EB6F.5090503@redhat.com> (raw)
In-Reply-To: <20090121001131.GF21648@machine.or.cz>
Petr Baudis wrote:
> On Mon, Jan 19, 2009 at 03:20:11PM +0100, Gerd Hoffmann wrote:
>> I do see the point in adding a interface like this ...
>>
>>> ssize_t readz (int fd, void *buf, size_t len, void **res)
>> ... to help the kernel do zero-copy I/O.
>>
>> I think system calls for vector I/O are *not* the right place for that
>> though. Usually applications use vectored I/O because they *do* care
>> about the place the data is stored, because vectored I/O allows them to
>> avoid copying data within the application.
>
> Can you elaborate on this? An application would have to have quite a
> contrived design if its pointers simply cannot be updated according
> to what the kernel returns.
Well. The "just update the pointers" argument is bogous. It simply
doesn't work in general for a number of reasons:
First, it assumes that there is a pointer you can update in the first place.
Second, it assumes you can easily update all pointer instances pointing
to your data. Finding all places which need updating might be
non-trivial or impossible. This tends to be true for refcounted data
structures.
Third, updating pointers can have extra costs, such as locking
requirements in threaded applications.
Of course there are also tons of applications where it is absolutely no
problem to just update the pointer.
But I think that applications using the vectored I/O very likely belong
to the group which can't. Otherwise there would be little reason to use
the vectored API in the first place.
> Then again, I'm not sure why wouldn't readv() actually be
> zerocopy-ready. Just make sure you handle iov_base being NULL gracefully
> now (EINVAL, with the remark that the kernel can write to the iovec
> memory area in the future) and later the kernel can in that case set
> iov_base to the buffer location?
You could (assuming you don't break POSIX along the way). I don't think
apps would use such an interface though for the reasons outlined above.
The readz() prototype by Ullrich (without iovecs being involved) looks
much more reasonable to me.
cheers,
Gerd
prev parent reply other threads:[~2009-01-21 9:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 16:45 [PATCH v6 0/5] Add preadv & pwritev system calls Gerd Hoffmann
2009-01-16 16:45 ` [PATCH 1/5] create compat_readv() Gerd Hoffmann
2009-01-16 16:45 ` [PATCH 2/5] create compat_writev() Gerd Hoffmann
2009-01-16 17:28 ` Arnd Bergmann
2009-01-16 16:45 ` [PATCH 3/5] Add preadv and pwritev system calls Gerd Hoffmann
2009-01-16 17:34 ` Arnd Bergmann
2009-01-16 16:45 ` [PATCH 4/5] MIPS: Add preadv(2) and pwritev(2) syscalls Gerd Hoffmann
2009-01-16 16:45 ` [PATCH 5/5] switch compat readv/preadv/writev/pwritev from fget to fget_light Gerd Hoffmann
2009-01-16 16:53 ` [PATCH v6 0/5] Add preadv & pwritev system calls Michael Kerrisk
2009-01-16 17:52 ` Arnd Bergmann
2009-01-16 19:20 ` Ulrich Drepper
2009-01-19 14:20 ` Gerd Hoffmann
2009-01-21 0:11 ` Petr Baudis
2009-01-21 9:31 ` Gerd Hoffmann [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=4976EB6F.5090503@redhat.com \
--to=kraxel@redhat.com \
--cc=aarcange@redhat.com \
--cc=arnd@arndb.de \
--cc=drepper@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pasky@suse.cz \
/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