Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56917443 authored by Shan Wei's avatar Shan Wei Committed by Antonio Quartulli
Browse files

batman-adv: use per_cpu_add helper



this_cpu_add is an atomic operation.
and be more faster than per_cpu_ptr operation.

Signed-off-by: default avatarShan Wei <davidshan@tencent.com>
Reviewed-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent 00494be4
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -276,9 +276,7 @@ static inline bool batadv_has_timed_out(unsigned long timestamp,
static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx,
				      size_t count)
{
	int cpu = get_cpu();
	per_cpu_ptr(bat_priv->bat_counters, cpu)[idx] += count;
	put_cpu();
	this_cpu_add(bat_priv->bat_counters[idx], count);
}

#define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1)