From: Christoph Lameter Date: Mon, 6 Dec 2010 17:40:06 +0000 (-0600) Subject: random: Use this_cpu_inc_return X-Git-Tag: firefly_0821_release~7613^2~3101^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b29c617af3b09d150d3889836c24d39564b39180;p=firefly-linux-kernel-4.4.55.git random: Use this_cpu_inc_return __this_cpu_inc can create a single instruction to do the same as __get_cpu_var()++. Cc: Richard Kennedy Cc: Matt Mackall Acked-by: H. Peter Anvin Signed-off-by: Christoph Lameter Signed-off-by: Tejun Heo --- diff --git a/drivers/char/random.c b/drivers/char/random.c index 5a1aa64f4e76..72a4fcb17745 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -626,7 +626,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) preempt_disable(); /* if over the trickle threshold, use only 1 in 4096 samples */ if (input_pool.entropy_count > trickle_thresh && - (__get_cpu_var(trickle_count)++ & 0xfff)) + ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff)) goto out; sample.jiffies = jiffies;