All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Linux kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: Re: drivers/char/random.c:write_pool() -- cond_resched needed?
Date: Mon, 3 Dec 2007 12:49:59 -0600	[thread overview]
Message-ID: <20071203184958.GN17536@waste.org> (raw)
In-Reply-To: <20071130215810.d3m43bwobifihfiu@m.safari.iki.fi>

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.

      reply	other threads:[~2007-12-03 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 21:58 drivers/char/random.c:write_pool() -- cond_resched needed? Sami Farin
2007-12-03 18:49 ` Matt Mackall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071203184958.GN17536@waste.org \
    --to=mpm@selenic.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.