Commit 5146a574 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'remove-sk-skb-caches'



Paolo Abeni says:

====================
net: remove sk skb caches

Eric noted we would be better off reverting the sk
skb caches.

MPTCP relies on such a feature, so we need a
little refactor of the MPTCP tx path before the mentioned
revert.

The first patch exposes additional TCP helpers. The 2nd patch
changes the MPTCP code to do locally the whole skb allocation
and updating, so it does not rely anymore on core TCP helpers
for that nor the sk skb cache.

As a side effect, we can make the tcp_build_frag helper static.

Finally, we can pull Eric's revert.

RFC -> v1:
 - drop driver specific patch - no more needed after helper rename
 - rename skb_entail -> tcp_skb_entail (Eric)
 - preserve the tcp_build_frag helpwe, just make it static (Eric)
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents efe686ff d8b81175
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -989,14 +989,6 @@ tcp_challenge_ack_limit - INTEGER
	in RFC 5961 (Improving TCP's Robustness to Blind In-Window Attacks)
	Default: 1000

tcp_rx_skb_cache - BOOLEAN
	Controls a per TCP socket cache of one skb, that might help
	performance of some workloads. This might be dangerous
	on systems with a lot of TCP sockets, since it increases
	memory usage.

	Default: 0 (disabled)

UDP variables
=============

+0 −19
Original line number Diff line number Diff line
@@ -262,7 +262,6 @@ struct bpf_local_storage;
  *	@sk_dst_cache: destination cache
  *	@sk_dst_pending_confirm: need to confirm neighbour
  *	@sk_policy: flow policy
  *	@sk_rx_skb_cache: cache copy of recently accessed RX skb
  *	@sk_receive_queue: incoming packets
  *	@sk_wmem_alloc: transmit queue bytes committed
  *	@sk_tsq_flags: TCP Small Queues flags
@@ -328,7 +327,6 @@ struct bpf_local_storage;
  *	@sk_peek_off: current peek_offset value
  *	@sk_send_head: front of stuff to transmit
  *	@tcp_rtx_queue: TCP re-transmit queue [union with @sk_send_head]
  *	@sk_tx_skb_cache: cache copy of recently accessed TX skb
  *	@sk_security: used by security modules
  *	@sk_mark: generic packet mark
  *	@sk_cgrp_data: cgroup data for this cgroup
@@ -393,7 +391,6 @@ struct sock {
	atomic_t		sk_drops;
	int			sk_rcvlowat;
	struct sk_buff_head	sk_error_queue;
	struct sk_buff		*sk_rx_skb_cache;
	struct sk_buff_head	sk_receive_queue;
	/*
	 * The backlog queue is special, it is always used with
@@ -442,7 +439,6 @@ struct sock {
		struct sk_buff	*sk_send_head;
		struct rb_root	tcp_rtx_queue;
	};
	struct sk_buff		*sk_tx_skb_cache;
	struct sk_buff_head	sk_write_queue;
	__s32			sk_peek_off;
	int			sk_write_pending;
@@ -1555,18 +1551,10 @@ static inline void sk_mem_uncharge(struct sock *sk, int size)
		__sk_mem_reclaim(sk, 1 << 20);
}

DECLARE_STATIC_KEY_FALSE(tcp_tx_skb_cache_key);
static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
{
	sk_wmem_queued_add(sk, -skb->truesize);
	sk_mem_uncharge(sk, skb->truesize);
	if (static_branch_unlikely(&tcp_tx_skb_cache_key) &&
	    !sk->sk_tx_skb_cache && !skb_cloned(skb)) {
		skb_ext_reset(skb);
		skb_zcopy_clear(skb, true);
		sk->sk_tx_skb_cache = skb;
		return;
	}
	__kfree_skb(skb);
}

@@ -2575,7 +2563,6 @@ static inline void skb_setup_tx_timestamp(struct sk_buff *skb, __u16 tsflags)
			   &skb_shinfo(skb)->tskey);
}

DECLARE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key);
/**
 * sk_eat_skb - Release a skb if it is no longer needed
 * @sk: socket to eat this skb from
@@ -2587,12 +2574,6 @@ DECLARE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key);
static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
{
	__skb_unlink(skb, &sk->sk_receive_queue);
	if (static_branch_unlikely(&tcp_rx_skb_cache_key) &&
	    !sk->sk_rx_skb_cache) {
		sk->sk_rx_skb_cache = skb;
		skb_orphan(skb);
		return;
	}
	__kfree_skb(skb);
}

+2 −2
Original line number Diff line number Diff line
@@ -330,8 +330,6 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
		 int flags);
int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset,
			size_t size, int flags);
struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int flags,
			       struct page *page, int offset, size_t *size);
ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
		 size_t size, int flags);
int tcp_send_mss(struct sock *sk, int *size_goal, int flags);
@@ -581,6 +579,8 @@ __u32 cookie_v6_init_sequence(const struct sk_buff *skb, __u16 *mss);
#endif
/* tcp_output.c */

void tcp_skb_entail(struct sock *sk, struct sk_buff *skb);
void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb);
void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
			       int nonagle);
int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs);
+0 −4
Original line number Diff line number Diff line
@@ -133,10 +133,6 @@ void inet_sock_destruct(struct sock *sk)
	struct inet_sock *inet = inet_sk(sk);

	__skb_queue_purge(&sk->sk_receive_queue);
	if (sk->sk_rx_skb_cache) {
		__kfree_skb(sk->sk_rx_skb_cache);
		sk->sk_rx_skb_cache = NULL;
	}
	__skb_queue_purge(&sk->sk_error_queue);

	sk_mem_reclaim(sk);
+0 −12
Original line number Diff line number Diff line
@@ -585,18 +585,6 @@ static struct ctl_table ipv4_table[] = {
		.extra1		= &sysctl_fib_sync_mem_min,
		.extra2		= &sysctl_fib_sync_mem_max,
	},
	{
		.procname	= "tcp_rx_skb_cache",
		.data		= &tcp_rx_skb_cache_key.key,
		.mode		= 0644,
		.proc_handler	= proc_do_static_key,
	},
	{
		.procname	= "tcp_tx_skb_cache",
		.data		= &tcp_tx_skb_cache_key.key,
		.mode		= 0644,
		.proc_handler	= proc_do_static_key,
	},
	{ }
};

Loading