From: Ezra Kissel <kissel@cis.udel.edu>
To: linux-kernel@vger.kernel.org
Subject: network socket receive splice size
Date: Fri, 20 Jun 2008 15:04:35 -0400 [thread overview]
Message-ID: <485BFF43.80404@cis.udel.edu> (raw)
I am using the splice syscall in kernel 2.6.25.4 with network socket
receive to splice incoming and outgoing TCP sockets. I perform something
like the following:
#define SPLICE_SIZE (12*1024)
int fd[2];
ret = pipe(fd);
ret = splice(src, NULL, fd[1], NULL, SPLICE_SIZE, SPLICE_F_MORE |
SPLICE_F_MOVE);
bytes_left = ret;
while (bytes_left > 0) {
ret = splice(fd[0], NULL, sink, NULL, bytes_left, SPLICE_F_NONBLOCK);
bytes_left -= ret;
}
This works well when SPLICE_SIZE is around 12K or lower, but anything
much more than that will cause the src splice call to block either right
away or after a few iterations. It almost seems as though the pipe
buffer is becoming full although I have used poll to check for both
sockets and pipe fds before calling splice, and the sink splice call
always sends the current number of bytes. I have also tried virtually
all combinations of the SPLICE_F_ options without success. Has anyone
run into a similar issue with socket-to-socket splicing and larger
splice sizes? I would really like to use the full 64K splice size to and
from the pipe.
I should mention that the splice test applications do work correctly
with 64K splice sizes when splicing to/from a network socket(s) to
STDOUT or STDIN. Any thoughts?
reply other threads:[~2008-06-20 19:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=485BFF43.80404@cis.udel.edu \
--to=kissel@cis.udel.edu \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®