Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7069
b: refs/heads/master
c: d80d99d
h: refs/heads/master
i:
  7067: b3fe1ba
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Sep 2, 2005
1 parent 1508ef4 commit 248553b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 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: 2dac4b96b9362954a0638317b90e3e7bcb112e83
refs/heads/master: d80d99d643090c3cf2b1f9fb3fadd1256f7e384f
12 changes: 8 additions & 4 deletions trunk/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb)
sk_stream_mem_schedule(sk, skb->truesize, 1);
}

static inline int sk_stream_wmem_schedule(struct sock *sk, int size)
{
return size <= sk->sk_forward_alloc ||
sk_stream_mem_schedule(sk, size, 0);
}

/* Used by processes to "lock" a socket state, so that
* interrupts and bottom half handlers won't change it
* from under us. It essentially blocks any incoming
Expand Down Expand Up @@ -1203,8 +1209,7 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
skb = alloc_skb_fclone(size + hdr_len, gfp);
if (skb) {
skb->truesize += mem;
if (sk->sk_forward_alloc >= (int)skb->truesize ||
sk_stream_mem_schedule(sk, skb->truesize, 0)) {
if (sk_stream_wmem_schedule(sk, skb->truesize)) {
skb_reserve(skb, hdr_len);
return skb;
}
Expand All @@ -1227,8 +1232,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
{
struct page *page = NULL;

if (sk->sk_forward_alloc >= (int)PAGE_SIZE ||
sk_stream_mem_schedule(sk, PAGE_SIZE, 0))
if (sk_stream_wmem_schedule(sk, PAGE_SIZE))
page = alloc_pages(sk->sk_allocation, 0);
else {
sk->sk_prot->enter_memory_pressure();
Expand Down
3 changes: 1 addition & 2 deletions trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
tcp_mark_push(tp, skb);
goto new_segment;
}
if (sk->sk_forward_alloc < copy &&
!sk_stream_mem_schedule(sk, copy, 0))
if (!sk_stream_wmem_schedule(sk, copy))
goto wait_for_memory;

if (can_coalesce) {
Expand Down

0 comments on commit 248553b

Please sign in to comment.