aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 02fdda68718d..cbcc9fc47783 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -552,8 +552,7 @@ new_segment:
552 tcp_mark_push(tp, skb); 552 tcp_mark_push(tp, skb);
553 goto new_segment; 553 goto new_segment;
554 } 554 }
555 if (sk->sk_forward_alloc < copy && 555 if (!sk_stream_wmem_schedule(sk, copy))
556 !sk_stream_mem_schedule(sk, copy, 0))
557 goto wait_for_memory; 556 goto wait_for_memory;
558 557
559 if (can_coalesce) { 558 if (can_coalesce) {
@@ -770,19 +769,23 @@ new_segment:
770 if (off == PAGE_SIZE) { 769 if (off == PAGE_SIZE) {
771 put_page(page); 770 put_page(page);
772 TCP_PAGE(sk) = page = NULL; 771 TCP_PAGE(sk) = page = NULL;
772 TCP_OFF(sk) = off = 0;
773 } 773 }
774 } 774 } else
775 BUG_ON(off);
776
777 if (copy > PAGE_SIZE - off)
778 copy = PAGE_SIZE - off;
779
780 if (!sk_stream_wmem_schedule(sk, copy))
781 goto wait_for_memory;
775 782
776 if (!page) { 783 if (!page) {
777 /* Allocate new cache page. */ 784 /* Allocate new cache page. */
778 if (!(page = sk_stream_alloc_page(sk))) 785 if (!(page = sk_stream_alloc_page(sk)))
779 goto wait_for_memory; 786 goto wait_for_memory;
780 off = 0;
781 } 787 }
782 788
783 if (copy > PAGE_SIZE - off)
784 copy = PAGE_SIZE - off;
785
786 /* Time to copy data. We are close to 789 /* Time to copy data. We are close to
787 * the end! */ 790 * the end! */
788 err = skb_copy_to_page(sk, from, skb, page, 791 err = skb_copy_to_page(sk, from, skb, page,