diff options
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r-- | drivers/char/random.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 7ae7ea65da68..6da3f250804c 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -282,10 +282,8 @@ | |||
282 | #define LONGS(x) (((x) + sizeof(unsigned long) - 1)/sizeof(unsigned long)) | 282 | #define LONGS(x) (((x) + sizeof(unsigned long) - 1)/sizeof(unsigned long)) |
283 | 283 | ||
284 | /* | 284 | /* |
285 | * To allow fractional bits to be tracked, the following fields contain | 285 | * To allow fractional bits to be tracked, the entropy_count field is |
286 | * this many fractional bits: | 286 | * denominated in units of 1/8th bits. |
287 | * | ||
288 | * entropy_count, trickle_thresh | ||
289 | * | 287 | * |
290 | * 2*(ENTROPY_SHIFT + log2(poolbits)) must <= 31, or the multiply in | 288 | * 2*(ENTROPY_SHIFT + log2(poolbits)) must <= 31, or the multiply in |
291 | * credit_entropy_bits() needs to be 64 bits wide. | 289 | * credit_entropy_bits() needs to be 64 bits wide. |
@@ -314,14 +312,6 @@ static int random_write_wakeup_thresh = 128; | |||
314 | static int random_min_urandom_seed = 60; | 312 | static int random_min_urandom_seed = 60; |
315 | 313 | ||
316 | /* | 314 | /* |
317 | * When the input pool goes over trickle_thresh, start dropping most | ||
318 | * samples to avoid wasting CPU time and reduce lock contention. | ||
319 | */ | ||
320 | static const int trickle_thresh = (INPUT_POOL_WORDS * 28) << ENTROPY_SHIFT; | ||
321 | |||
322 | static DEFINE_PER_CPU(int, trickle_count); | ||
323 | |||
324 | /* | ||
325 | * Originally, we used a primitive polynomial of degree .poolwords | 315 | * Originally, we used a primitive polynomial of degree .poolwords |
326 | * over GF(2). The taps for various sizes are defined below. They | 316 | * over GF(2). The taps for various sizes are defined below. They |
327 | * were chosen to be evenly spaced except for the last tap, which is 1 | 317 | * were chosen to be evenly spaced except for the last tap, which is 1 |
@@ -755,10 +745,6 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) | |||
755 | long delta, delta2, delta3; | 745 | long delta, delta2, delta3; |
756 | 746 | ||
757 | preempt_disable(); | 747 | preempt_disable(); |
758 | /* if over the trickle threshold, use only 1 in 4096 samples */ | ||
759 | if (ENTROPY_BITS(&input_pool) > trickle_thresh && | ||
760 | ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff)) | ||
761 | goto out; | ||
762 | 748 | ||
763 | sample.jiffies = jiffies; | 749 | sample.jiffies = jiffies; |
764 | sample.cycles = random_get_entropy(); | 750 | sample.cycles = random_get_entropy(); |
@@ -800,7 +786,6 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) | |||
800 | credit_entropy_bits(&input_pool, | 786 | credit_entropy_bits(&input_pool, |
801 | min_t(int, fls(delta>>1), 11)); | 787 | min_t(int, fls(delta>>1), 11)); |
802 | } | 788 | } |
803 | out: | ||
804 | preempt_enable(); | 789 | preempt_enable(); |
805 | } | 790 | } |
806 | 791 | ||