From: Larry McVoy <lm@bitmover.com>
To: Thomas Ogrisegg <tom@rhadamanthys.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] TCP Zero Copy for mmapped files
Date: Sun, 29 Dec 2002 17:29:37 -0800 [thread overview]
Message-ID: <20021230012937.GC5156@work.bitmover.com> (raw)
In-Reply-To: <20021230010953.GA17731@window.dhis.org>
How about putting this into a different function? It's a lot to add
inline for a special case.
> int tcp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
> {
> struct iovec *iov;
> @@ -1015,6 +1051,7 @@
> int mss_now;
> int err, copied;
> long timeo;
> + int has_sendpage = sk->socket->file->f_op->sendpage != NULL;
>
> tp = &(sk->tp_pinfo.af_tcp);
>
> @@ -1049,6 +1086,44 @@
>
> iov++;
>
> + if (seglen >= PAGE_SIZE && has_sendpage) {
> + struct vm_area_struct *vma =
> + find_vma (current->mm, (long) from);
> + struct file *filp;
> +
> + if (vma && (filp = vma->vm_file)) {
> + read_descriptor_t desc;
> + struct inode *in, *out;
> + loff_t pos = (long) from - vma->vm_start;
> +
> + in = filp->f_dentry->d_inode;
> + out = sk->socket->file->f_dentry->d_inode;
> +
> + if (locks_verify_area (FLOCK_VERIFY_READ, in,
> + filp, filp->f_pos, seglen))
> + goto out_no_zero_copy;
> +
> + if (locks_verify_area (FLOCK_VERIFY_WRITE, out,
> + sk->socket->file, 0, seglen))
> + goto out_no_zero_copy;
> +
> + desc.written = 0;
> + desc.count = seglen;
> + desc.buf = (char *) sk;
> + desc.error = 0;
> +
> + do_generic_file_read (filp, &pos, &desc,
> + file_send_actor);
> +
> + if (!desc.written) {
> + err = desc.error;
> + goto do_error;
> + }
> + copied += desc.written;
> + continue;
> + }
> + }
> +out_no_zero_copy:
> while (seglen > 0) {
> int copy;
>
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
next prev parent reply other threads:[~2002-12-30 1:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-30 1:09 [PATCH] TCP Zero Copy for mmapped files Thomas Ogrisegg
2002-12-30 1:29 ` Larry McVoy [this message]
2003-01-02 6:37 ` David S. Miller
2003-01-02 22:12 ` Thomas Ogrisegg
2003-01-02 22:28 ` Larry McVoy
2003-01-02 23:20 ` Alan Cox
2003-01-02 23:16 ` David S. Miller
2003-01-03 0:56 ` Alan Cox
2003-01-03 2:40 ` David S. Miller
2003-01-03 2:41 ` Linus Torvalds
2003-01-02 23:13 ` David S. Miller
2003-01-03 0:45 ` Thomas Ogrisegg
2003-01-03 1:01 ` Larry McVoy
2003-01-03 1:59 ` Alan Cox
2003-01-06 14:36 ` Gianni Tedesco
2003-01-06 23:29 ` David S. Miller
2003-01-03 1:56 ` Alan Cox
2003-01-03 1:27 ` Larry McVoy
2003-01-03 2:42 ` David S. Miller
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=20021230012937.GC5156@work.bitmover.com \
--to=lm@bitmover.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tom@rhadamanthys.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