lkml.org 
[lkml]   [2009]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] netfilter: use per-cpu spinlock rather than RCU
    Stephen Hemminger a écrit :
    > This is an alternative version of ip/ip6/arp tables locking using
    > per-cpu locks. This avoids the overhead of synchronize_net() during
    > update but still removes the expensive rwlock in earlier versions.
    >
    > The idea for this came from an earlier version done by Eric Duzamet.
    > Locking is done per-cpu, the fast path locks on the current cpu
    > and updates counters. The slow case involves acquiring the locks on
    > all cpu's.
    >
    > The mutex that was added for 2.6.30 in xt_table is unnecessary since
    > there already is a mutex for xt[af].mutex that is held.
    >
    > Tested basic functionality (add/remove/list), but don't have test cases
    > for stress, ip6tables or arptables.
    >
    > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

    Patch seems good to me, but apparently xt_replace_table()
    misses the "acquiring the locks on all cpus" you mentioned in ChangeLog ?

    I am still off-computers until tomorrow so cannot provide a patch for this, sorry.

    Some form of

    local_bh_disable();
    for_each_possible_cpu(cpu)
    spin_lock(&per_cpu(ip_tables_lock, cpu));

    oldinfo = private;
    /* do the substitution */
    table->private = newinfo;
    newinfo->initial_entries = oldinfo->initial_entries;

    for_each_possible_cpu(cpu)
    spin_unlock(&per_cpu(ip_tables_lock, cpu));
    local_bh_enable();


    But I wonder if this could hit a limit of max spinlocks held by this cpu, say on a 4096 cpu machine ?



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-04-13 19:45    [W:0.021 / U:33.928 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site