lkml.org 
[lkml]   [2010]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[rfc: cpuops adv V1 2/8] Fallback to atomic xchg, cmpxchg
    Sorry this should have been:

    Subject: this_cpu_xchg/cmpxchg: Fall back to atomic xchg, cmpxchg

    It may be better if we fall back to the full operation instead of
    simulation through irq disable etc.

    Signed-off-by: Christoph Lameter <cl@linux.com>

    ---
    include/linux/percpu.h | 31 +++----------------------------
    1 file changed, 3 insertions(+), 28 deletions(-)

    Index: linux-2.6/include/linux/percpu.h
    ===================================================================
    --- linux-2.6.orig/include/linux/percpu.h 2010-12-02 12:17:14.000000000 -0600
    +++ linux-2.6/include/linux/percpu.h 2010-12-02 12:17:30.000000000 -0600
    @@ -361,14 +361,7 @@ do { \
    # define __this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval)
    #endif

    -#define _this_cpu_generic_xchg(pcp, nval) \
    -({ typeof(pcp) ret__; \
    - preempt_disable(); \
    - ret__ = __this_cpu_read(pcp); \
    - __this_cpu_write(pcp, nval); \
    - preempt_enable(); \
    - ret__; \
    -})
    +#define _this_cpu_generic_xchg(pcp, nval) xchg(__this_cpu_ptr(&(pcp)), nval)

    #ifndef this_cpu_xchg
    # ifndef this_cpu_xchg_1
    @@ -386,15 +379,7 @@ do { \
    # define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
    #endif

    -#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
    -({ typeof(pcp) ret__; \
    - preempt_disable(); \
    - ret__ = __this_cpu_read(pcp); \
    - if (ret__ == (oval)) \
    - __this_cpu_write(pcp, nval); \
    - preempt_enable(); \
    - ret__; \
    -})
    +#define _this_cpu_generic_cmpxchg(pcp, oval, nval) cmpxchg(__this_cpu_ptr(&(pcp)), oval, nval);

    #ifndef this_cpu_cmpxchg
    # ifndef this_cpu_cmpxchg_1
    @@ -892,17 +877,7 @@ do { \
    # define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
    #endif

    -#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval) \
    -({ \
    - typeof(pcp) ret__; \
    - unsigned long flags; \
    - local_irq_save(flags); \
    - ret__ = __this_cpu_read(pcp); \
    - if (ret__ == (oval)) \
    - __this_cpu_write(pcp, nval); \
    - local_irq_restore(flags); \
    - ret__; \
    -})
    +#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval) cmpxchg(__this_cpu_ptr(&(pcp), oval, nval)

    #ifndef irqsafe_cpu_cmpxchg
    # ifndef irqsafe_cpu_cmpxchg_1

    \
     
     \ /
      Last update: 2010-12-02 23:09    [W:5.038 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site