From patchwork Wed Jun 10 10:40:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 482593 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 59EB11401DA for ; Wed, 10 Jun 2015 20:41:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.b=1rMyxTRv; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964792AbbFJKk7 (ORCPT ); Wed, 10 Jun 2015 06:40:59 -0400 Received: from forward-corp1g.mail.yandex.net ([95.108.253.251]:35899 "EHLO forward-corp1g.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932694AbbFJKkr (ORCPT ); Wed, 10 Jun 2015 06:40:47 -0400 Received: from smtpcorp1m.mail.yandex.net (smtpcorp1m.mail.yandex.net [77.88.61.150]) by forward-corp1g.mail.yandex.net (Yandex) with ESMTP id 877BD3660C8C; Wed, 10 Jun 2015 13:40:45 +0300 (MSK) Received: from smtpcorp1m.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp1m.mail.yandex.net (Yandex) with ESMTP id 5BF462CA0521; Wed, 10 Jun 2015 13:40:45 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:408:ae:3705:67a7:32ac]) by smtpcorp1m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 0nLqkp4q15-ejcKACYG; Wed, 10 Jun 2015 13:40:45 +0300 (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1433932845; bh=3PKx4PWlMqPl3REUlcUgnt3rMvWvZkTItF6xnY9DSYM=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1rMyxTRvnnnKk/l/9HmnKARHi/Fy6zqqca5ORPBUffFmenlouGT8BtKTDEemX08e0 Vs88U9m2M8c2d1p+dvzlbJO9RQvwQ+brtBPlkL1bKRksyDa3y7RUyf4trdYB3WgQsa F3vCcxv/xWS8aLQTDRkT4wxiEYmEGfM4LmzGDpMA= Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 3.10.y 2/2] ipv6: update ip6_rt_last_gc every time GC is run From: Konstantin Khlebnikov To: stable@vger.kernel.org Cc: Michal Kubecek , netdev@vger.kernel.org, "David S. Miller" Date: Wed, 10 Jun 2015 13:40:45 +0300 Message-ID: <20150610104045.3791.99481.stgit@buzz> In-Reply-To: <20150610103926.3791.22866.stgit@buzz> References: <20150610103926.3791.22866.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Michal Kubeček commit 49a18d86f66d33a20144ecb5a34bba0d1856b260 upstream As pointed out by Eric Dumazet, net->ipv6.ip6_rt_last_gc should hold the last time garbage collector was run so that we should update it whenever fib6_run_gc() calls fib6_clean_all(), not only if we got there from ip6_dst_gc(). Signed-off-by: Michal Kubecek Signed-off-by: David S. Miller --- net/ipv6/ip6_fib.c | 6 +++++- net/ipv6/route.c | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 0b5e9086322d..46458ee31939 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -1650,6 +1650,8 @@ static DEFINE_SPINLOCK(fib6_gc_lock); void fib6_run_gc(unsigned long expires, struct net *net, bool force) { + unsigned long now; + if (force) { spin_lock_bh(&fib6_gc_lock); } else if (!spin_trylock_bh(&fib6_gc_lock)) { @@ -1662,10 +1664,12 @@ void fib6_run_gc(unsigned long expires, struct net *net, bool force) gc_args.more = icmp6_dst_gc(); fib6_clean_all(net, fib6_age, 0, NULL); + now = jiffies; + net->ipv6.ip6_rt_last_gc = now; if (gc_args.more) mod_timer(&net->ipv6.ip6_fib_timer, - round_jiffies(jiffies + round_jiffies(now + net->ipv6.sysctl.ip6_rt_gc_interval)); else del_timer(&net->ipv6.ip6_fib_timer); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index bd83c90f970c..6ebefd46f718 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1334,7 +1334,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), static int ip6_dst_gc(struct dst_ops *ops) { - unsigned long now = jiffies; struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; @@ -1344,13 +1343,12 @@ static int ip6_dst_gc(struct dst_ops *ops) int entries; entries = dst_entries_get_fast(ops); - if (time_after(rt_last_gc + rt_min_interval, now) && + if (time_after(rt_last_gc + rt_min_interval, jiffies) && entries <= rt_max_size) goto out; net->ipv6.ip6_rt_gc_expire++; fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); - net->ipv6.ip6_rt_last_gc = now; entries = dst_entries_get_slow(ops); if (entries < ops->gc_thresh) net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;