From: "David S. Miller" <davem@davemloft.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: anton@samba.org, netdev@oss.sgi.com
Subject: Re: [DEBUG]: sk_forward_alloc assertion failures
Date: Fri, 14 Jan 2005 20:55:43 -0800 [thread overview]
Message-ID: <20050114205543.5acb0d68.davem@davemloft.net> (raw)
In-Reply-To: <20050114224745.GA13180@gondor.apana.org.au>
On Sat, 15 Jan 2005 09:47:45 +1100
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> However, it's not all that difficult to fix up either. We can adjust
> truesize to a more reasonable value in tcp_write_xmit(). Something
> like this will do.
>
> Actually it happens in the case of sendmsg() too. Unfortunately in
> that case we can't do a thing about it since the memory is allocated
> between skb->head and skb->tail.
Doing the adjustments at tcp_write_xmit() time also runs into the
problem you mentioned where we're just blindly subtracting from
sk_forward_alloc.
I really still feel that the best way is to "adjust as we add data".
sendmsg() does that already, I tried to add it simply to sendpage()
but it just needs some checks and wait_for_memory logic.
Here's a patch against current BK that tries to do that. See any
holes? :-)
===== net/ipv4/tcp.c 1.89 vs edited =====
--- 1.89/net/ipv4/tcp.c 2005-01-13 19:57:57 -08:00
+++ edited/net/ipv4/tcp.c 2005-01-14 20:22:27 -08:00
@@ -655,7 +655,7 @@
while (psize > 0) {
struct sk_buff *skb = sk->sk_write_queue.prev;
struct page *page = pages[poffset / PAGE_SIZE];
- int copy, i;
+ int copy, i, can_coalesce;
int offset = poffset % PAGE_SIZE;
int size = min_t(size_t, psize, PAGE_SIZE - offset);
@@ -677,14 +677,20 @@
copy = size;
i = skb_shinfo(skb)->nr_frags;
- if (skb_can_coalesce(skb, i, page, offset)) {
+ can_coalesce = skb_can_coalesce(skb, i, page, offset);
+ if (!can_coalesce && i >= MAX_SKB_FRAGS) {
+ tcp_mark_push(tp, skb);
+ goto new_segment;
+ }
+ if (sk->sk_forward_alloc < copy &&
+ !sk_stream_mem_schedule(sk, copy, 0))
+ goto wait_for_memory;
+
+ if (can_coalesce) {
skb_shinfo(skb)->frags[i - 1].size += copy;
- } else if (i < MAX_SKB_FRAGS) {
+ } else {
get_page(page);
skb_fill_page_desc(skb, i, page, offset, copy);
- } else {
- tcp_mark_push(tp, skb);
- goto new_segment;
}
skb->len += copy;
next prev parent reply other threads:[~2005-01-15 4:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-14 1:12 [DEBUG]: sk_forward_alloc assertion failures David S. Miller
2005-01-14 1:25 ` Anton Blanchard
2005-01-14 4:19 ` David S. Miller
2005-01-14 11:16 ` Herbert Xu
2005-01-14 12:03 ` Herbert Xu
2005-01-14 19:03 ` David S. Miller
2005-01-14 20:34 ` Herbert Xu
2005-01-14 21:27 ` David S. Miller
2005-01-14 21:38 ` Herbert Xu
2005-01-14 21:36 ` David S. Miller
2005-01-14 21:55 ` Herbert Xu
2005-01-14 22:04 ` David S. Miller
2005-01-14 22:47 ` Herbert Xu
2005-01-15 4:55 ` David S. Miller [this message]
2005-01-15 5:45 ` Herbert Xu
2005-01-17 20:37 ` David S. Miller
2005-01-17 20:40 ` Herbert Xu
2005-01-14 21:34 ` Herbert Xu
2005-01-14 1:37 ` Herbert Xu
2005-01-14 4:09 ` David S. Miller
2005-01-14 1:50 ` Sridhar Samudrala
2005-01-14 2:10 ` Herbert Xu
2005-01-14 3:44 ` David S. Miller
-- strict thread matches above, loose matches on Subject: below --
2005-01-16 23:03 Nancy Milliner
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=20050114205543.5acb0d68.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=anton@samba.org \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@oss.sgi.com \
/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).