Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c17ac85504efec5f3a9b0c5b05bffd6f30e5b655
Commit:     c17ac85504efec5f3a9b0c5b05bffd6f30e5b655
Parent:     b2d9323d139f5c384fa1ef1d74773b4db1c09b3d
Author:     Paul E. McKenney <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 23:27:19 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 08:42:53 2007 -0700

    Make rcutorture RNG use temporal entropy
    
    Repost of http://lkml.org/lkml/2007/8/10/472 made available by request.
    
    The locking used by get_random_bytes() can conflict with the
    preempt_disable() and synchronize_sched() form of RCU.  This patch changes
    rcutorture's RNG to gather entropy from the new cpu_clock() interface
    (relying on interrupts, preemption, daemons, and rcutorture's reader
    thread's rock-bottom scheduling priority to provide useful entropy), and
    also adds and EXPORT_SYMBOL_GPL() to make that interface available to GPLed
    kernel modules such as rcutorture.
    
    Passes several hours of rcutorture.
    
    [EMAIL PROTECTED]: Use raw_smp_processor_id() in rcu_random()]
    Signed-off-by: Paul E. McKenney <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Gautham R Shenoy <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/rcutorture.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index dd413bf..c3e165c 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -41,7 +41,6 @@
 #include <linux/notifier.h>
 #include <linux/freezer.h>
 #include <linux/cpu.h>
-#include <linux/random.h>
 #include <linux/delay.h>
 #include <linux/byteorder/swabb.h>
 #include <linux/stat.h>
@@ -165,16 +164,14 @@ struct rcu_random_state {
 
 /*
  * Crude but fast random-number generator.  Uses a linear congruential
- * generator, with occasional help from get_random_bytes().
+ * generator, with occasional help from cpu_clock().
  */
 static unsigned long
 rcu_random(struct rcu_random_state *rrsp)
 {
-       long refresh;
-
        if (--rrsp->rrs_count < 0) {
-               get_random_bytes(&refresh, sizeof(refresh));
-               rrsp->rrs_state += refresh;
+               rrsp->rrs_state +=
+                       (unsigned long)cpu_clock(raw_smp_processor_id());
                rrsp->rrs_count = RCU_RANDOM_REFRESH;
        }
        rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to