Re: [RFC] percpu: convert SNMP mibs to new infra

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Wednesday, April 1, 2009 - 10:19 pm

Rusty Russell a écrit :

I tried to find a generic CONFIG_ define that would annonce that an arche
has a fast percpu_add() implementation. (faster than __raw_get_cpu_var,
for example, when we already are in a preempt disabled section)

Any idea ?


For example, net/ipv4/route.c has :

static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
#define RT_CACHE_STAT_INC(field) \
        (__raw_get_cpu_var(rt_cache_stat).field++)

We could use percpu_add(rt_cache_stat.field, 1) instead, only if percpu_add()
is not the generic one.

#define __percpu_generic_to_op(var, val, op)                            \
do {                                                                    \
        get_cpu_var(var) op val;                                        \
        put_cpu_var(var);                                               \
} while (0)
#ifndef percpu_add
# define percpu_add(var, val)           __percpu_generic_to_op(var, (val), +=)
#endif

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] x86: percpu_to_op() misses memory and flags cl ..., Jeremy Fitzhardinge, (Wed Apr 1, 2:02 am)
Re: [PATCH] x86: percpu_to_op() misses memory and flags cl ..., Jeremy Fitzhardinge, (Wed Apr 1, 9:41 am)
Re: [PATCH] x86: percpu_to_op() misses memory and flags cl ..., Jeremy Fitzhardinge, (Wed Apr 1, 11:07 am)
[RFC] percpu: convert SNMP mibs to new infra, Eric Dumazet, (Wed Apr 1, 11:44 am)
Re: [RFC] percpu: convert SNMP mibs to new infra, Tejun Heo, (Wed Apr 1, 5:13 pm)
Re: [RFC] percpu: convert SNMP mibs to new infra, Ingo Molnar, (Wed Apr 1, 9:05 pm)
Re: [RFC] percpu: convert SNMP mibs to new infra, Rusty Russell, (Wed Apr 1, 10:04 pm)
Re: [RFC] percpu: convert SNMP mibs to new infra, Eric Dumazet, (Wed Apr 1, 10:19 pm)
[PATCH] percpu: convert SNMP mibs to new infra, Eric Dumazet, (Thu Apr 2, 1:07 am)
Re: [RFC] percpu: convert SNMP mibs to new infra, Rusty Russell, (Thu Apr 2, 4:46 am)
Re: [PATCH] x86: percpu_to_op() misses memory and flags cl ..., Jeremy Fitzhardinge, (Thu Apr 2, 7:12 am)
Re: [PATCH] percpu: convert SNMP mibs to new infra, Ingo Molnar, (Fri Apr 3, 10:10 am)