Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4fe34bf authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller
Browse files

tcp_memcontrol: Remove the per netns control.



The code that is implemented is per memory cgroup not per netns, and
having per netns bits is just confusing.  Remove the per netns bits to
make it easier to see what is really going on.

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f594d631
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ struct netns_ipv4 {
	int sysctl_tcp_ecn;

	kgid_t sysctl_ping_group_range[2];
	long sysctl_tcp_mem[3];

	atomic_t dev_addr_genid;

+1 −2
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ extern int sysctl_tcp_max_orphans;
extern int sysctl_tcp_fack;
extern int sysctl_tcp_reordering;
extern int sysctl_tcp_dsack;
extern long sysctl_tcp_mem[3];
extern int sysctl_tcp_wmem[3];
extern int sysctl_tcp_rmem[3];
extern int sysctl_tcp_app_win;
@@ -348,8 +349,6 @@ extern struct proto tcp_prot;
#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
#define TCP_ADD_STATS(net, field, val)	SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)

void tcp_init_mem(struct net *net);

void tcp_tasklet_init(void);

void tcp_v4_err(struct sk_buff *skb, u32);
+0 −2
Original line number Diff line number Diff line
@@ -1697,8 +1697,6 @@ static int __init inet_init(void)
	ip_static_sysctl_init();
#endif

	tcp_prot.sysctl_mem = init_net.ipv4.sysctl_tcp_mem;

	/*
	 *	Add all the base protocols.
	 */
+7 −16
Original line number Diff line number Diff line
@@ -200,14 +200,6 @@ static int proc_allowed_congestion_control(struct ctl_table *ctl,
	return ret;
}

static int ipv4_tcp_mem(struct ctl_table *ctl, int write,
			   void __user *buffer, size_t *lenp,
			   loff_t *ppos)
{
	ctl->data = &current->nsproxy->net_ns->ipv4.sysctl_tcp_mem;
	return proc_doulongvec_minmax(ctl, write, buffer, lenp, ppos);
}

static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write,
				 void __user *buffer, size_t *lenp,
				 loff_t *ppos)
@@ -521,6 +513,13 @@ static struct ctl_table ipv4_table[] = {
		.mode		= 0644,
		.proc_handler	= proc_dointvec
	},
	{
		.procname	= "tcp_mem",
		.maxlen		= sizeof(sysctl_tcp_mem),
		.data		= &sysctl_tcp_mem,
		.mode		= 0644,
		.proc_handler	= proc_doulongvec_minmax,
	},
	{
		.procname	= "tcp_wmem",
		.data		= &sysctl_tcp_wmem,
@@ -830,12 +829,6 @@ static struct ctl_table ipv4_net_table[] = {
		.mode		= 0644,
		.proc_handler	= ipv4_local_port_range,
	},
	{
		.procname	= "tcp_mem",
		.maxlen		= sizeof(init_net.ipv4.sysctl_tcp_mem),
		.mode		= 0644,
		.proc_handler	= ipv4_tcp_mem,
	},
	{ }
};

@@ -887,8 +880,6 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
	net->ipv4.sysctl_local_ports.range[0] =  32768;
	net->ipv4.sysctl_local_ports.range[1] =  61000;

	tcp_init_mem(net);

	net->ipv4.ipv4_hdr = register_net_sysctl(net, "net/ipv4", table);
	if (net->ipv4.ipv4_hdr == NULL)
		goto err_reg;
+7 −5
Original line number Diff line number Diff line
@@ -288,9 +288,11 @@ int sysctl_tcp_min_tso_segs __read_mostly = 2;
struct percpu_counter tcp_orphan_count;
EXPORT_SYMBOL_GPL(tcp_orphan_count);

long sysctl_tcp_mem[3] __read_mostly;
int sysctl_tcp_wmem[3] __read_mostly;
int sysctl_tcp_rmem[3] __read_mostly;

EXPORT_SYMBOL(sysctl_tcp_mem);
EXPORT_SYMBOL(sysctl_tcp_rmem);
EXPORT_SYMBOL(sysctl_tcp_wmem);

@@ -3097,13 +3099,13 @@ static int __init set_thash_entries(char *str)
}
__setup("thash_entries=", set_thash_entries);

void tcp_init_mem(struct net *net)
static void tcp_init_mem(void)
{
	unsigned long limit = nr_free_buffer_pages() / 8;
	limit = max(limit, 128UL);
	net->ipv4.sysctl_tcp_mem[0] = limit / 4 * 3;
	net->ipv4.sysctl_tcp_mem[1] = limit;
	net->ipv4.sysctl_tcp_mem[2] = net->ipv4.sysctl_tcp_mem[0] * 2;
	sysctl_tcp_mem[0] = limit / 4 * 3;
	sysctl_tcp_mem[1] = limit;
	sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
}

void __init tcp_init(void)
@@ -3165,7 +3167,7 @@ void __init tcp_init(void)
	sysctl_tcp_max_orphans = cnt / 2;
	sysctl_max_syn_backlog = max(128, cnt / 256);

	tcp_init_mem(&init_net);
	tcp_init_mem();
	/* Set per-socket limits to no more than 1/128 the pressure threshold */
	limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
	max_wshare = min(4UL*1024*1024, limit);
Loading