public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/char/random.c:write_pool() -- cond_resched needed?
@ 2007-11-30 21:58 Sami Farin
  2007-12-03 18:49 ` Matt Mackall
  0 siblings, 1 reply; 2+ messages in thread
From: Sami Farin @ 2007-11-30 21:58 UTC (permalink / raw)
  To: Linux kernel Mailing List

In write_pool(), isn't cond_resched() needed after call to
add_entropy_words() because otherwise there can be large latencies
(think of command "dd if=/dev/zero of=/dev/random bs=100000000" ) ?

-- 
Do what you love because life is too short for anything else.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: drivers/char/random.c:write_pool() -- cond_resched needed?
  2007-11-30 21:58 drivers/char/random.c:write_pool() -- cond_resched needed? Sami Farin
@ 2007-12-03 18:49 ` Matt Mackall
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Mackall @ 2007-12-03 18:49 UTC (permalink / raw)
  To: Linux kernel Mailing List; +Cc: Andrew Morton

On Fri, Nov 30, 2007 at 11:58:10PM +0200, Sami Farin wrote:
> In write_pool(), isn't cond_resched() needed after call to
> add_entropy_words() because otherwise there can be large latencies
> (think of command "dd if=/dev/zero of=/dev/random bs=100000000" ) ?

Yes, looks like you're right.

Reduce latency for large writes to /dev/[u]random

Signed-off-by: Matt Mackall <mpm@selenic.com>

diff -r c60016ba6237 drivers/char/random.c
--- a/drivers/char/random.c	Tue Nov 13 09:09:36 2007 -0800
+++ b/drivers/char/random.c	Mon Dec 03 12:48:30 2007 -0600
@@ -1041,6 +1041,7 @@ write_pool(struct entropy_store *r, cons
 		p += bytes;
 
 		add_entropy_words(r, buf, (bytes + 3) / 4);
+		cond_resched();
 	}
 
 	return 0;


-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-03 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-30 21:58 drivers/char/random.c:write_pool() -- cond_resched needed? Sami Farin
2007-12-03 18:49 ` Matt Mackall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox