Unverified Commit 4a112fbf authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4399 net: dst: Optimized route gc

Merge Pull Request from: @ci-robot 
 
PR sync from: Dong Chenchen <dongchenchen2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/3MABM7JT2E55LAPHWUKUMOPCMAKPFUCX/ 
Eric Dumazet (1):
  net/dst: use a smaller percpu_counter batch for dst entries accounting

Peter Oskolkov (1):
  net: add a route cache full diagnostic message


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I90HST 
 
Link:https://gitee.com/openeuler/kernel/pulls/4399

 

Reviewed-by: default avatarLiu YongQiang <liuyongqiang13@huawei.com>
Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents d707b08b 6bb432e9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -63,9 +63,11 @@ static inline int dst_entries_get_slow(struct dst_ops *dst)
	return percpu_counter_sum_positive(&dst->pcpuc_entries);
}

#define DST_PERCPU_COUNTER_BATCH 32
static inline void dst_entries_add(struct dst_ops *dst, int val)
{
	percpu_counter_add(&dst->pcpuc_entries, val);
	percpu_counter_add_batch(&dst->pcpuc_entries, val,
				 DST_PERCPU_COUNTER_BATCH);
}

static inline int dst_entries_init(struct dst_ops *dst)
+6 −2
Original line number Diff line number Diff line
@@ -97,10 +97,14 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
{
	struct dst_entry *dst;

	if (ops->gc && dst_entries_get_fast(ops) > ops->gc_thresh) {
		if (ops->gc(ops))
	if (ops->gc &&
	    !(flags & DST_NOCOUNT) &&
	    dst_entries_get_fast(ops) > ops->gc_thresh) {
		if (ops->gc(ops)) {
			pr_notice_ratelimited("Route cache is full: consider increasing sysctl net.ipv6.route.max_size.\n");
			return NULL;
		}
	}

	dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC);
	if (!dst)
+3 −0
Original line number Diff line number Diff line
@@ -2781,6 +2781,9 @@ static int ip6_dst_gc(struct dst_ops *ops)
	int entries;

	entries = dst_entries_get_fast(ops);
	if (entries > rt_max_size)
		entries = dst_entries_get_slow(ops);

	if (time_after(rt_last_gc + rt_min_interval, jiffies) &&
	    entries <= rt_max_size)
		goto out;