diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-11-29 04:28:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:07 -0500 |
commit | f561d0f27d6283c49359bb96048f8ac3728c812c (patch) | |
tree | 95665f72ac84fc9c91f5c1ee568f169984631887 /include/net/sock.h | |
parent | 3015a347dcd470fcc8becf1f84b0502391a3c0e0 (diff) |
[NET]: Uninline the sk_stream_alloc_pskb
This function seems too big for inlining. Indeed, it saves
half-a-kilo when uninlined:
add/remove: 1/0 grow/shrink: 0/7 up/down: 195/-719 (-524)
function old new delta
sk_stream_alloc_pskb - 195 +195
ip_rt_init 529 525 -4
__inet_lookup_listener 284 274 -10
tcp_sendmsg 2583 2486 -97
tcp_sendpage 1449 1305 -144
tso_fragment 417 267 -150
tcp_fragment 1149 992 -157
__tcp_push_pending_frames 1998 1841 -157
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index e329d05f7995..7d500a825e4e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1192,33 +1192,8 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) | |||
1192 | } | 1192 | } |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | 1195 | struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, |
1196 | int size, int mem, | 1196 | int size, int mem, gfp_t gfp); |
1197 | gfp_t gfp) | ||
1198 | { | ||
1199 | struct sk_buff *skb; | ||
1200 | |||
1201 | /* The TCP header must be at least 32-bit aligned. */ | ||
1202 | size = ALIGN(size, 4); | ||
1203 | |||
1204 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | ||
1205 | if (skb) { | ||
1206 | skb->truesize += mem; | ||
1207 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { | ||
1208 | /* | ||
1209 | * Make sure that we have exactly size bytes | ||
1210 | * available to the caller, no more, no less. | ||
1211 | */ | ||
1212 | skb_reserve(skb, skb_tailroom(skb) - size); | ||
1213 | return skb; | ||
1214 | } | ||
1215 | __kfree_skb(skb); | ||
1216 | } else { | ||
1217 | sk->sk_prot->enter_memory_pressure(); | ||
1218 | sk_stream_moderate_sndbuf(sk); | ||
1219 | } | ||
1220 | return NULL; | ||
1221 | } | ||
1222 | 1197 | ||
1223 | static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, | 1198 | static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, |
1224 | int size, | 1199 | int size, |