Skip to content

Commit

Permalink
[NET]: Make the sk_clone() lighter
Browse files Browse the repository at this point in the history
The sk_prot_alloc() already performs all the stuff needed by the
sk_clone(). Besides, the sk_prot_alloc() requires almost twice
less arguments than the sk_alloc() does, so call the sk_prot_alloc()
saving the stack a bit.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Nov 1, 2007
1 parent 2e4afe7 commit 8fd1d17
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,9 @@ void sk_free(struct sock *sk)

struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
{
struct sock *newsk = sk_alloc(sk->sk_net, sk->sk_family, priority, sk->sk_prot, 0);
struct sock *newsk;

newsk = sk_prot_alloc(sk->sk_prot, priority, sk->sk_family);
if (newsk != NULL) {
struct sk_filter *filter;

Expand Down

0 comments on commit 8fd1d17

Please sign in to comment.