lkml.org 
[lkml]   [2017]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 152/153] netfilter: conntrack: remove GC_MAX_EVICTS break
    Date
    4.9-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Florian Westphal <fw@strlen.de>

    commit 524b698db06b9b6da7192e749f637904e2f62d7b 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>

    ---
    net/netfilter/nf_conntrack_core.c | 7 ++-----
    1 file changed, 2 insertions(+), 5 deletions(-)

    --- a/net/netfilter/nf_conntrack_core.c
    +++ b/net/netfilter/nf_conntrack_core.c
    @@ -88,8 +88,6 @@ static __read_mostly bool nf_conntrack_l
    #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
    */
    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
    * 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) {

    \
     
     \ /
      Last update: 2017-03-10 11:37    [W:4.122 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site