[lkml]   [2002]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patch] readv/writev rework
Hirokazu Takahashi wrote:
> Hello,
> Your readv/writev patch interested me and I checked it.
> I found we also have a chance to improve normal writev.
> a_ops->prepare_write() and a_ops->commit_write will have a
> penalty when I/O size isn't PAGE_SIZE.
> With following patch generic_file_write_nolock() will try to
> make each I/O size become PAGE_SIZE.

Certainly makes a lot of sense. If an application has a large
number of small objects which are to be appended to a file, and
they are not contiguous in user memory then this patch makes
writev() a very attractive way of doing that. Tons faster.

However I'd be a little concerned over the increased work which a boring
old write() has to do. Perhaps we could add a special code path
for it:

struct iovstate {
unsigned rest;
unsigned copy;
unsigned off;
struct iovec *work_iov;
char *work_buf;
unsigned work_iov_bytes;
} iovstate;

if (nr_segs != 1) {
initialise iovstate;


if (nr_segs == 1)
page_fault = filemap_copy_from_user(page, offset, buf, bytes);
page_fault = iov_copy_from_user(&arg1, &arg2, &bytes, &iovstate);
status = a_ops->commit_write(file, page, offset, offset+bytes);

then we can do all that fancy stuff in iov_copy_from_user(). That
function should be inlined so we don't really pass all those arguments
around. That's just a cleanliness thing, and branching around the complex
code in the simple case. We should be able to get the impact on the
common case down to a single taken branch per page.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:28    [W:0.059 / U:1.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site