提交 c4ead4c5 编写于 作者: E Eric Dumazet 提交者: David S. Miller

tcp: tso_fragment() might avoid GFP_ATOMIC

We can pass a gfp argument to tso_fragment() and avoid GFP_ATOMIC
allocations sometimes.
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9618e2ff
...@@ -1460,7 +1460,7 @@ int tcp_may_send_now(struct sock *sk) ...@@ -1460,7 +1460,7 @@ int tcp_may_send_now(struct sock *sk)
* packet has never been sent out before (and thus is not cloned). * packet has never been sent out before (and thus is not cloned).
*/ */
static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
unsigned int mss_now) unsigned int mss_now, gfp_t gfp)
{ {
struct sk_buff *buff; struct sk_buff *buff;
int nlen = skb->len - len; int nlen = skb->len - len;
...@@ -1470,7 +1470,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, ...@@ -1470,7 +1470,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
if (skb->len != skb->data_len) if (skb->len != skb->data_len)
return tcp_fragment(sk, skb, len, mss_now); return tcp_fragment(sk, skb, len, mss_now);
buff = sk_stream_alloc_skb(sk, 0, GFP_ATOMIC); buff = sk_stream_alloc_skb(sk, 0, gfp);
if (unlikely(buff == NULL)) if (unlikely(buff == NULL))
return -ENOMEM; return -ENOMEM;
...@@ -1768,7 +1768,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, ...@@ -1768,7 +1768,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
cwnd_quota); cwnd_quota);
if (skb->len > limit && if (skb->len > limit &&
unlikely(tso_fragment(sk, skb, limit, mss_now))) unlikely(tso_fragment(sk, skb, limit, mss_now, gfp)))
break; break;
TCP_SKB_CB(skb)->when = tcp_time_stamp; TCP_SKB_CB(skb)->when = tcp_time_stamp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册