netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Leech <christopher.leech@intel.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 7/9] I/OAT: Only offload copies for TCP when there will be a context switch
Date: Fri, 02 Mar 2007 18:24:30 -0800	[thread overview]
Message-ID: <20070303022430.31033.18636.stgit@gitlost.site> (raw)
In-Reply-To: <20070303022238.31033.84558.stgit@gitlost.site>

The performance wins come with having the DMA copy engine doing the copies
in parallel with the context switch.  If there is enough data ready on the
socket at recv time just use a regular copy.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
---

 net/ipv4/tcp.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 74c4d10..5ccd5e1 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1110,6 +1110,8 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	long timeo;
 	struct task_struct *user_recv = NULL;
 	int copied_early = 0;
+	int available = 0;
+	struct sk_buff *skb;
 
 	lock_sock(sk);
 
@@ -1136,7 +1138,11 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 #ifdef CONFIG_NET_DMA
 	tp->ucopy.dma_chan = NULL;
 	preempt_disable();
-	if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
+	skb = skb_peek_tail(&sk->sk_receive_queue);
+	if (skb)
+		available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
+	if ((available < target) &&
+	    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
 	    !sysctl_tcp_low_latency && __get_cpu_var(softnet_data).net_dma) {
 		preempt_enable_no_resched();
 		tp->ucopy.pinned_list = dma_pin_iovec_pages(msg->msg_iov, len);
@@ -1145,7 +1151,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 #endif
 
 	do {
-		struct sk_buff *skb;
 		u32 offset;
 
 		/* Are we at urgent data? Stop if we have read anything or have SIGURG pending. */
@@ -1433,7 +1438,6 @@ skip_copy:
 
 #ifdef CONFIG_NET_DMA
 	if (tp->ucopy.dma_chan) {
-		struct sk_buff *skb;
 		dma_cookie_t done, used;
 
 		dma_async_memcpy_issue_pending(tp->ucopy.dma_chan);

  parent reply	other threads:[~2007-03-03  2:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-03  2:22 [PATCH 0/9] I/OAT fixes Chris Leech
2007-03-03  2:24 ` [PATCH 1/9] ioatdma: Push pending transactions to hardware more frequently Chris Leech
2007-03-03  3:14   ` Jeff Garzik
2007-03-03  4:27     ` David Miller
2007-03-03  6:00       ` Chris Leech
2007-03-03  2:24 ` [PATCH 2/9] drivers/dma: handle sysfs errors Chris Leech
2007-03-03  2:24 ` [PATCH 3/9] ioatdma: Remove the wrappers around read(bwl)/write(bwl) in ioatdma Chris Leech
2007-03-03  2:24 ` [PATCH 4/9] ioatdma: Remove the use of writeq from the ioatdma driver Chris Leech
2007-03-03  2:24 ` [PATCH 5/9] I/OAT: Add documentation for the tcp_dma_copybreak sysctl Chris Leech
2007-03-03  2:24 ` [PATCH 6/9] I/OAT: Add entries to MAINTAINERS for the DMA memcpy subsystem and ioatdma Chris Leech
2007-03-03  2:24 ` Chris Leech [this message]
2007-03-03  2:24 ` [PATCH 8/9] I/OAT: warning fix Chris Leech
2007-03-03  2:24 ` [PATCH 9/9] I/OAT: fix I/OAT for kexec Chris Leech

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=20070303022430.31033.18636.stgit@gitlost.site \
    --to=christopher.leech@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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).