Commit df97c708 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[NET]: Eliminate unused argument from sk_stream_alloc_pskb

The 3rd argument is always zero (according to grep :) Eliminate
it and merge the function with sk_stream_alloc_skb.

This saves 44 more bytes, and together with the previous patch
we have:

add/remove: 1/0 grow/shrink: 0/8 up/down: 183/-751 (-568)
function                                     old     new   delta
sk_stream_alloc_skb                            -     183    +183
ip_rt_init                                   529     525      -4
arp_ignore                                   112     107      -5
__inet_lookup_listener                       284     274     -10
tcp_sendmsg                                 2583    2481    -102
tcp_sendpage                                1449    1300    -149
tso_fragment                                 417     258    -159
tcp_fragment                                1149     988    -161
__tcp_push_pending_frames                   1998    1837    -161
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f561d0f2
...@@ -1192,15 +1192,7 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) ...@@ -1192,15 +1192,7 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
} }
} }
struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp);
int size, int mem, gfp_t gfp);
static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk,
int size,
gfp_t gfp)
{
return sk_stream_alloc_pskb(sk, size, 0, gfp);
}
static inline struct page *sk_stream_alloc_page(struct sock *sk) static inline struct page *sk_stream_alloc_page(struct sock *sk)
{ {
......
...@@ -629,8 +629,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, ...@@ -629,8 +629,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
return ret; return ret;
} }
struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp)
int size, int mem, gfp_t gfp)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -639,7 +638,6 @@ struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, ...@@ -639,7 +638,6 @@ struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
if (skb) { if (skb) {
skb->truesize += mem;
if (sk_stream_wmem_schedule(sk, skb->truesize)) { if (sk_stream_wmem_schedule(sk, skb->truesize)) {
/* /*
* Make sure that we have exactly size bytes * Make sure that we have exactly size bytes
...@@ -692,8 +690,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse ...@@ -692,8 +690,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
if (!sk_stream_memory_free(sk)) if (!sk_stream_memory_free(sk))
goto wait_for_sndbuf; goto wait_for_sndbuf;
skb = sk_stream_alloc_pskb(sk, 0, 0, skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
sk->sk_allocation);
if (!skb) if (!skb)
goto wait_for_memory; goto wait_for_memory;
...@@ -873,8 +870,8 @@ int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, ...@@ -873,8 +870,8 @@ int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
if (!sk_stream_memory_free(sk)) if (!sk_stream_memory_free(sk))
goto wait_for_sndbuf; goto wait_for_sndbuf;
skb = sk_stream_alloc_pskb(sk, select_size(sk), skb = sk_stream_alloc_skb(sk, select_size(sk),
0, sk->sk_allocation); sk->sk_allocation);
if (!skb) if (!skb)
goto wait_for_memory; goto wait_for_memory;
......
...@@ -1180,7 +1180,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, ...@@ -1180,7 +1180,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_pskb(sk, 0, 0, GFP_ATOMIC); buff = sk_stream_alloc_skb(sk, 0, GFP_ATOMIC);
if (unlikely(buff == NULL)) if (unlikely(buff == NULL))
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment