Re: [PATCH RFC/RFT net-next 00/17] net: Convert neighbor tables to per-namespace
From: Eric W. Biederman <hidden>
Date: 2018-08-15 04:36:28
Also in:
lkml, netfilter-devel
David Ahern [off-list ref] writes:
On 7/25/18 1:17 PM, Eric W. Biederman wrote:quoted
David Ahern [off-list ref] writes:quoted
On 7/25/18 11:38 AM, Eric W. Biederman wrote:quoted
Absolutely NOT. Global thresholds are exactly correct given the fact you are running on a single kernel. Memory is not free (Even though we are swimming in enough of it memory rarely matters). One of the few remaining challenges is for containers is finding was to limit resources in such a way that one application does not mess things up for another container during ordinary usage. It looks like the neighbour tables absolutely are that kind of problem, because the artificial limits are too strict. Completely giving up on limits does not seem right approach either. We need to fix the limits we have (perhaps making them go away entirely), not just apply a band-aid. Let's get to the bottom of this and make the system better.Eric: yes, they all share the global resource of memory and there should be limits on how many entries a remote entity can create. Network namespaces can provide a separation such that one namespace does not disrupt networking in another. It is absolutely appropriate to do so. Your rigid stance is inconsistent given the basic meaning of a network namespace and the parallels to this same problem -- bridges, vxlans, and ip fragments. Only neighbor tables are not per-device or per namespace; your insistence on global limits is missing the mark and wrong.That is not what I said. Let me rephrase and see if you understand. The problem appears to be of lots of devices. Fundamentally if you use lots of network devices today unless you adjust gc_thresh3 you will run out of neighbour table entries. The problem has a bigger scope than what you are looking at. If you fix the core problem you won't see the problem in the context of network namespaces either. Default limits should be something that will never be hit unless something goes crazy. We are hitting them. Therefore by definition there is a bug in these limits.I disagree that the problem is a global limit. It is trivial for users to increase gc_thresh3. That does not solve the fundamental problem.quoted
And yes there is absolutely a place for global limits on things like inodes, file descriptors etc, that does not care about which part of the kernel you are in. However hitting those limits in normal operation is a bug. We have ourselves a bug.I agree we have a bug; we disagree on what that bug is. I am just back from vacation and re-read your responses. No where do you acknowledge the fundamental point of this patch set - that adding a new neighbor entry in one namespace can evict an entry in another namespace or worse networking in one namespace can fail due to table overflow because of entries from another. That is a real problem. It is not a matter of increasing the default gc_thresh3 to some number N; it is ensuring that regardless of the value of gc_thresh3 one namespace is not affected by another.
My suggestion is to look at the problem and it's requirements and figure out how to safely remove gc_thresh3 entirely. We do have to ensure neighbour tables don't grow too large, I expect we can do it in a way that can scale from a small machine with few neighbours to a large machine with many neighbours. Perhaps the code just needs to limit the number of neighbours who have never replied and the code is probing for an a per interface basis. It still may make sense to have a global limit of perhaps a million entries just because that would be an indicator that something has truly gone weird.
You created network namespaces and it provides isolation -- separate tables essentially -- for devices, FIB entries, sockets, etc, but you argue against completing the task with separate neighbor tables which is very strange given the impact (completely broken networking).
Namespaces provide isolation at the level of names. The objects still share a kernel and compete for resources. Not competing for resources would require each namespace have it's own dedicated pool of resources which over the whole machine would be much less efficient. That is the fundamental design difference between namespaces and VM's and it is why namespaces can be much cheaper and much more resource efficient. Reserving your worst case resource usage ahead of time tends to result in a lot of inefficiencies. Eric