Commit 35fc07ae authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'tcp-add-three-static-keys'



Eric Dumazet says:

====================
tcp: add three static keys

Recent addition of per TCP socket rx/tx cache brought
regressions for some workloads, as reported by Feng Tang.

It seems better to make them opt-in, before we adopt better
heuristics.

The last patch adds high_order_alloc_disable sysctl
to ask TCP sendmsg() to exclusively use order-0 allocations,
as mm layer has specific optimizations.
====================

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

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:

udp_l3mdev_accept - BOOLEAN
+0 −1
Original line number Diff line number Diff line
@@ -600,7 +600,6 @@ void bpf_map_area_free(void *base);
void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);

extern int sysctl_unprivileged_bpf_disabled;
extern int sysctl_bpf_stats_enabled;

int bpf_map_new_fd(struct bpf_map *map, int flags);
int bpf_prog_new_fd(struct bpf_prog *prog);
+3 −0
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
				      void __user *, size_t *, loff_t *);
extern int proc_do_large_bitmap(struct ctl_table *, int,
				void __user *, size_t *, loff_t *);
extern int proc_do_static_key(struct ctl_table *table, int write,
			      void __user *buffer, size_t *lenp,
			      loff_t *ppos);

/*
 * Register a set of sysctl names by calling register_sysctl_table
+7 −5
Original line number Diff line number Diff line
@@ -1463,12 +1463,14 @@ 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)
{
	sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
	sk->sk_wmem_queued -= skb->truesize;
	sk_mem_uncharge(sk, skb->truesize);
	if (!sk->sk_tx_skb_cache && !skb_cloned(skb)) {
	if (static_branch_unlikely(&tcp_tx_skb_cache_key) &&
	    !sk->sk_tx_skb_cache && !skb_cloned(skb)) {
		skb_zcopy_clear(skb, true);
		sk->sk_tx_skb_cache = skb;
		return;
@@ -2433,13 +2435,11 @@ static inline void skb_setup_tx_timestamp(struct sk_buff *skb, __u16 tsflags)
 * This routine must be called with interrupts disabled or with the socket
 * locked so that the sk_buff queue operation is ok.
*/
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 (
#ifdef CONFIG_RPS
	    !static_branch_unlikely(&rps_needed) &&
#endif
	if (static_branch_unlikely(&tcp_rx_skb_cache_key) &&
	    !sk->sk_rx_skb_cache) {
		sk->sk_rx_skb_cache = skb;
		skb_orphan(skb);
@@ -2534,6 +2534,8 @@ extern int sysctl_optmem_max;
extern __u32 sysctl_wmem_default;
extern __u32 sysctl_rmem_default;

DECLARE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key);

static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto)
{
	/* Does this proto have per netns sysctl_wmem ? */
+0 −1
Original line number Diff line number Diff line
@@ -2097,7 +2097,6 @@ int __weak skb_copy_bits(const struct sk_buff *skb, int offset, void *to,

DEFINE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
EXPORT_SYMBOL(bpf_stats_enabled_key);
int sysctl_bpf_stats_enabled __read_mostly;

/* All definitions of tracepoints related to BPF. */
#define CREATE_TRACE_POINTS
Loading