summaryrefslogtreecommitdiff
path: root/drivers/char/random.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2010-12-06 11:40:06 -0600
committerTejun Heo <tj@kernel.org>2010-12-17 15:18:05 +0100
commitb29c617af3b09d150d3889836c24d39564b39180 (patch)
tree17514cd85f64917e96d736b6dc5ac681dab93955 /drivers/char/random.c
parentee1be8626355e6a1f3f8c44e2351ff2661c5998d (diff)
downloadlwn-b29c617af3b09d150d3889836c24d39564b39180.tar.gz
lwn-b29c617af3b09d150d3889836c24d39564b39180.zip
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 <richard@rsk.demon.co.uk> Cc: Matt Mackall <mpm@selenic.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r--drivers/char/random.c2
1 files changed, 1 insertions, 1 deletions
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;