Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7070
b: refs/heads/master
c: ef01578
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Sep 2, 2005
1 parent 248553b commit b6dbbbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d80d99d643090c3cf2b1f9fb3fadd1256f7e384f
refs/heads/master: ef015786152adaff5a6a8bf0c8ea2f70cee8059d
5 changes: 2 additions & 3 deletions trunk/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,8 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
{
struct page *page = NULL;

if (sk_stream_wmem_schedule(sk, PAGE_SIZE))
page = alloc_pages(sk->sk_allocation, 0);
else {
page = alloc_pages(sk->sk_allocation, 0);
if (!page) {
sk->sk_prot->enter_memory_pressure();
sk_stream_moderate_sndbuf(sk);
}
Expand Down
14 changes: 9 additions & 5 deletions trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,19 +769,23 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (off == PAGE_SIZE) {
put_page(page);
TCP_PAGE(sk) = page = NULL;
TCP_OFF(sk) = off = 0;
}
}
} else
BUG_ON(off);

if (copy > PAGE_SIZE - off)
copy = PAGE_SIZE - off;

if (!sk_stream_wmem_schedule(sk, copy))
goto wait_for_memory;

if (!page) {
/* Allocate new cache page. */
if (!(page = sk_stream_alloc_page(sk)))
goto wait_for_memory;
off = 0;
}

if (copy > PAGE_SIZE - off)
copy = PAGE_SIZE - off;

/* Time to copy data. We are close to
* the end! */
err = skb_copy_to_page(sk, from, skb, page,
Expand Down

0 comments on commit b6dbbbc

Please sign in to comment.