lkml.org 
[lkml]   [2010]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[cpuops inc_return V1 8/9] 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>
Signed-off-by: Christoph Lameter <cl@linux.com>

---
drivers/char/random.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/char/random.c
===================================================================
--- linux-2.6.orig/drivers/char/random.c 2010-12-06 11:01:06.000000000 -0600
+++ linux-2.6/drivers/char/random.c 2010-12-06 11:19:38.000000000 -0600
@@ -626,7 +626,7 @@ static void add_timer_randomness(struct
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;


\
 
 \ /
  Last update: 2010-12-06 18:43    [W:0.133 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site