[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f814137b0bfc52f52a90.1200623624@cinder.waste.org>
Date: Thu, 17 Jan 2008 20:33:44 -0600
From: Matt Mackall <mpm@...enic.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 02 of 12] random: consolidate wakeup logic
Signed-off-by: Matt Mackall <mpm@...enic.com>
diff -r 905475c480bd -r f814137b0bfc drivers/char/random.c
--- a/drivers/char/random.c Thu Jan 17 20:25:23 2008 -0600
+++ b/drivers/char/random.c Thu Jan 17 20:25:23 2008 -0600
@@ -540,6 +540,10 @@
nbits, r->name);
}
+ /* should we wake readers? */
+ if (r == &input_pool && r->entropy_count >= random_read_wakeup_thresh)
+ wake_up_interruptible(&random_read_wait);
+
spin_unlock_irqrestore(&r->lock, flags);
}
@@ -624,10 +628,6 @@
credit_entropy_store(&input_pool,
min_t(int, fls(delta>>1), 11));
}
-
- if (input_pool.entropy_count >= random_read_wakeup_thresh)
- wake_up_interruptible(&random_read_wait);
-
out:
preempt_enable();
}
@@ -1082,12 +1082,6 @@
if (get_user(ent_count, p))
return -EFAULT;
credit_entropy_store(&input_pool, ent_count);
- /*
- * Wake up waiting processes if we have enough
- * entropy.
- */
- if (input_pool.entropy_count >= random_read_wakeup_thresh)
- wake_up_interruptible(&random_read_wait);
return 0;
case RNDADDENTROPY:
if (!capable(CAP_SYS_ADMIN))
@@ -1103,12 +1097,6 @@
if (retval < 0)
return retval;
credit_entropy_store(&input_pool, ent_count);
- /*
- * Wake up waiting processes if we have enough
- * entropy.
- */
- if (input_pool.entropy_count >= random_read_wakeup_thresh)
- wake_up_interruptible(&random_read_wait);
return 0;
case RNDZAPENTCNT:
case RNDCLEARPOOL:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists