mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
58956317c8
The existing garbage collection algorithm has a number of problems: 1. The gc algorithm will not evict PERMANENT entries as those entries are managed by userspace, yet the existing algorithm walks the entire hash table which means it always considers PERMANENT entries when looking for entries to evict. In some use cases (e.g., EVPN) there can be tens of thousands of PERMANENT entries leading to wasted CPU cycles when gc kicks in. As an example, with 32k permanent entries, neigh_alloc has been observed taking more than 4 msec per invocation. 2. Currently, when the number of neighbor entries hits gc_thresh2 and the last flush for the table was more than 5 seconds ago gc kicks in walks the entire hash table evicting *all* entries not in PERMANENT or REACHABLE state and not marked as externally learned. There is no discriminator on when the neigh entry was created or if it just moved from REACHABLE to another NUD_VALID state (e.g., NUD_STALE). It is possible for entries to be created or for established neighbor entries to be moved to STALE (e.g., an external node sends an ARP request) right before the 5 second window lapses: -----|---------x|----------|----- t-5 t t+5 If that happens those entries are evicted during gc causing unnecessary thrashing on neighbor entries and userspace caches trying to track them. Further, this contradicts the description of gc_thresh2 which says "Entries older than 5 seconds will be cleared". One workaround is to make gc_thresh2 == gc_thresh3 but that negates the whole point of having separate thresholds. 3. Clearing *all* neigh non-PERMANENT/REACHABLE/externally learned entries when gc_thresh2 is exceeded is over kill and contributes to trashing especially during startup. This patch addresses these problems as follows: 1. Use of a separate list_head to track entries that can be garbage collected along with a separate counter. PERMANENT entries are not added to this list. The gc_thresh parameters are only compared to the new counter, not the total entries in the table. The forced_gc function is updated to only walk this new gc_list looking for entries to evict. 2. Entries are added to the list head at the tail and removed from the front. 3. Entries are only evicted if they were last updated more than 5 seconds ago, adhering to the original intent of gc_thresh2. 4. Forced gc is stopped once the number of gc_entries drops below gc_thresh2. 5. Since gc checks do not apply to PERMANENT entries, gc levels are skipped when allocating a new neighbor for a PERMANENT entry. By extension this means there are no explicit limits on the number of PERMANENT entries that can be created, but this is no different than FIB entries or FDB entries. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> |
||
---|---|---|
.. | ||
caif | ||
device_drivers | ||
dsa | ||
mac80211_hwsim | ||
6lowpan.txt | ||
6pack.txt | ||
af_xdp.rst | ||
alias.rst | ||
altera_tse.txt | ||
arcnet-hardware.txt | ||
arcnet.txt | ||
atm.txt | ||
ax25.txt | ||
batman-adv.rst | ||
baycom.txt | ||
bonding.txt | ||
bridge.rst | ||
can_ucan_protocol.rst | ||
can.rst | ||
cdc_mbim.txt | ||
checksum-offloads.txt | ||
conf.py | ||
cops.txt | ||
cxacru-cf.py | ||
cxacru.txt | ||
dccp.txt | ||
dctcp.txt | ||
decnet.txt | ||
defza.txt | ||
devlink-params-bnxt.txt | ||
devlink-params.txt | ||
dns_resolver.txt | ||
driver.txt | ||
eql.txt | ||
failover.rst | ||
fib_trie.txt | ||
filter.txt | ||
fore200e.txt | ||
framerelay.txt | ||
gen_stats.txt | ||
generic_netlink.txt | ||
generic-hdlc.txt | ||
gtp.txt | ||
hinic.txt | ||
ieee802154.txt | ||
ila.txt | ||
index.rst | ||
ip_dynaddr.txt | ||
ip-sysctl.txt | ||
ipddp.txt | ||
iphase.txt | ||
ipsec.txt | ||
ipv6.txt | ||
ipvlan.txt | ||
ipvs-sysctl.txt | ||
kapi.rst | ||
kcm.txt | ||
l2tp.txt | ||
lapb-module.txt | ||
ltpc.txt | ||
mac80211-auth-assoc-deauth.txt | ||
mac80211-injection.txt | ||
mpls-sysctl.txt | ||
msg_zerocopy.rst | ||
multiqueue.txt | ||
net_dim.txt | ||
net_failover.rst | ||
netconsole.txt | ||
netdev-FAQ.rst | ||
netdev-features.txt | ||
netdevices.txt | ||
netfilter-sysctl.txt | ||
netif-msg.txt | ||
nf_conntrack-sysctl.txt | ||
nf_flowtable.txt | ||
nfc.txt | ||
openvswitch.txt | ||
operstates.txt | ||
packet_mmap.txt | ||
phonet.txt | ||
phy.txt | ||
pktgen.txt | ||
PLIP.txt | ||
ppp_generic.txt | ||
proc_net_tcp.txt | ||
radiotap-headers.txt | ||
ray_cs.txt | ||
rds.txt | ||
regulatory.txt | ||
rxrpc.txt | ||
scaling.txt | ||
sctp.txt | ||
secid.txt | ||
seg6-sysctl.txt | ||
segmentation-offloads.txt | ||
skfp.txt | ||
snmp_counter.rst | ||
strparser.txt | ||
switchdev.txt | ||
tc-actions-env-rules.txt | ||
tcp-thin.txt | ||
team.txt | ||
timestamping.txt | ||
tls.txt | ||
tproxy.txt | ||
tuntap.txt | ||
udplite.txt | ||
vrf.txt | ||
vxlan.txt | ||
x25-iface.txt | ||
x25.txt | ||
xfrm_device.txt | ||
xfrm_proc.txt | ||
xfrm_sync.txt | ||
xfrm_sysctl.txt | ||
z8530book.rst | ||
z8530drv.txt |