diff mbox

[nf] netfilter: conntrack: remove GC_MAX_EVICTS break

Message ID 1484587496-24177-1-git-send-email-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Florian Westphal Jan. 16, 2017, 5:24 p.m. UTC
Instead of breaking loop and instant resched, don't bother checking
this in first place (the loop calls cond_resched for every bucket anyway).

Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
As Nicolas suggested, split this part in its own commit.

Comments

Nicolas Dichtel Jan. 17, 2017, 9:10 a.m. UTC | #1
Le 16/01/2017 à 18:24, Florian Westphal a écrit :
> Instead of breaking loop and instant resched, don't bother checking
> this in first place (the loop calls cond_resched for every bucket anyway).
> 
> Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira Ayuso Jan. 19, 2017, 1:27 p.m. UTC | #2
On Tue, Jan 17, 2017 at 10:10:23AM +0100, Nicolas Dichtel wrote:
> Le 16/01/2017 à 18:24, Florian Westphal a écrit :
> > Instead of breaking loop and instant resched, don't bother checking
> > this in first place (the loop calls cond_resched for every bucket anyway).
> > 
> > Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 3a073cd9fcf4..6feb5d370319 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -88,8 +88,6 @@  static __read_mostly bool nf_conntrack_locks_all;
 #define GC_MAX_BUCKETS_DIV	64u
 /* upper bound of scan intervals */
 #define GC_INTERVAL_MAX		(2 * HZ)
-/* maximum conntracks to evict per gc run */
-#define GC_MAX_EVICTS		256u
 
 static struct conntrack_gc_work conntrack_gc_work;
 
@@ -979,8 +977,7 @@  static void gc_worker(struct work_struct *work)
 		 */
 		rcu_read_unlock();
 		cond_resched_rcu_qs();
-	} while (++buckets < goal &&
-		 expired_count < GC_MAX_EVICTS);
+	} while (++buckets < goal);
 
 	if (gc_work->exiting)
 		return;
@@ -1005,7 +1002,7 @@  static void gc_worker(struct work_struct *work)
 	 * In case we have lots of evictions next scan is done immediately.
 	 */
 	ratio = scanned ? expired_count * 100 / scanned : 0;
-	if (ratio >= 90 || expired_count == GC_MAX_EVICTS) {
+	if (ratio >= 90) {
 		gc_work->next_gc_run = 0;
 		next_run = 0;
 	} else if (expired_count) {