Re: [PATCHv4 10/11] drop_monitor: Use *_dec_not_zero instead of*_add_unless

From: Neil Horman
Date: Wed Jul 27 2011 - 06:59:30 EST


On Wed, Jul 27, 2011 at 11:47:49AM +0200, Sven Eckelmann wrote:
> atomic_dec_not_zero is defined for each architecture through
> <linux/atomic.h> to provide the functionality of
> atomic_add_unless(x, -1, 0).
>
> Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx>
> Cc: Neil Horman <nhorman@xxxxxxxxxxxxx>
> Cc: netdev@xxxxxxxxxxxxxxx
> ---
> net/core/drop_monitor.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
> index 7f36b38..ef4a05d 100644
> --- a/net/core/drop_monitor.c
> +++ b/net/core/drop_monitor.c
> @@ -137,7 +137,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location)
> struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data);
>
>
> - if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) {
> + if (!atomic_dec_not_zero(&data->dm_hit_count)) {
> /*
> * we're already at zero, discard this hit
> */
> --
> 1.7.5.4
>
>
Wheres the patch that creates the per arch definition of this function? I see
the other posts in this series went to lkml, but the archives don't have the
first in the series anywhere, which ostensibly adds the definition.
Neil

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