mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
netfilter: conntrack: remove GC_MAX_EVICTS break
commit 524b698db0 upstream.
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
dc8470f3c8
commit
5f7ff59d06
@@ -88,8 +88,6 @@ static __read_mostly bool nf_conntrack_locks_all;
|
|||||||
#define GC_MAX_BUCKETS_DIV 64u
|
#define GC_MAX_BUCKETS_DIV 64u
|
||||||
/* upper bound of scan intervals */
|
/* upper bound of scan intervals */
|
||||||
#define GC_INTERVAL_MAX (2 * HZ)
|
#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;
|
static struct conntrack_gc_work conntrack_gc_work;
|
||||||
|
|
||||||
@@ -979,8 +977,7 @@ static void gc_worker(struct work_struct *work)
|
|||||||
*/
|
*/
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
cond_resched_rcu_qs();
|
cond_resched_rcu_qs();
|
||||||
} while (++buckets < goal &&
|
} while (++buckets < goal);
|
||||||
expired_count < GC_MAX_EVICTS);
|
|
||||||
|
|
||||||
if (gc_work->exiting)
|
if (gc_work->exiting)
|
||||||
return;
|
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.
|
* In case we have lots of evictions next scan is done immediately.
|
||||||
*/
|
*/
|
||||||
ratio = scanned ? expired_count * 100 / scanned : 0;
|
ratio = scanned ? expired_count * 100 / scanned : 0;
|
||||||
if (ratio >= 90 || expired_count == GC_MAX_EVICTS) {
|
if (ratio >= 90) {
|
||||||
gc_work->next_gc_run = 0;
|
gc_work->next_gc_run = 0;
|
||||||
next_run = 0;
|
next_run = 0;
|
||||||
} else if (expired_count) {
|
} else if (expired_count) {
|
||||||
|
|||||||
Reference in New Issue
Block a user