summaryrefslogtreecommitdiff
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2022-06-11 06:30:16 +0300
committerDavid S. Miller <davem@davemloft.net>2022-06-13 15:35:25 +0300
commit219160be496f7f9cd105c5708e37cf22ab4ce0c7 (patch)
treecf2ec0a5c25c90def3f59acc871d490b4aa3afba /include/net/sock.h
parent4066bf4ce3ae3e322fa0c3c6418e45d99ff086b8 (diff)
downloadlinux-219160be496f7f9cd105c5708e37cf22ab4ce0c7.tar.xz
tcp: sk_forced_mem_schedule() optimization
sk_memory_allocated_add() has three callers, and returns to them @memory_allocated. sk_forced_mem_schedule() is one of them, and ignores the returned value. Change sk_memory_allocated_add() to return void. Change sock_reserve_memory() and __sk_mem_raise_allocated() to call sk_memory_allocated(). This removes one cache line miss [1] for RPC workloads, as first skbs in TCP write queue and receive queue go through sk_forced_mem_schedule(). [1] Cache line holding tcp_memory_allocated. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Reviewed-by: Shakeel Butt <shakeelb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 0063e8410a4e..304a5e39d41e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1412,7 +1412,7 @@ sk_memory_allocated(const struct sock *sk)
/* 1 MB per cpu, in page units */
#define SK_MEMORY_PCPU_RESERVE (1 << (20 - PAGE_SHIFT))
-static inline long
+static inline void
sk_memory_allocated_add(struct sock *sk, int amt)
{
int local_reserve;
@@ -1424,7 +1424,6 @@ sk_memory_allocated_add(struct sock *sk, int amt)
atomic_long_add(local_reserve, sk->sk_prot->memory_allocated);
}
preempt_enable();
- return sk_memory_allocated(sk);
}
static inline void