[lkml]   [2003]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectStack usage in random.c

Jeff Garzik whined about how much stack space was being used by
extract_entropy(). So I went and looked and reclaimed 352 bytes of stack.
Damn SHA ...

It's actually worse (better?) than that -- xfer_secondary_pool() can call
extract_entropy() again, so I may have saved over 700 bytes of stack
usage here. It's safe for xfer_secondary_pool() to share its parent's
tmp because it hasn't been used at this point.

--- linux-2.5.63/drivers/char/random.c 2003-02-24 13:05:06.000000000 -0600
+++ linux-2.5.63-random/drivers/char/random.c 2003-03-03 08:05:24.000000000 -0600
@@ -1228,10 +1228,8 @@
* at which point we do a "catastrophic reseeding".
static inline void xfer_secondary_pool(struct entropy_store *r,
- size_t nbytes)
+ size_t nbytes, __u32 *tmp)
- __u32 tmp[TMP_BUF_SIZE];
if (r->entropy_count < nbytes * 8 &&
r->entropy_count < r->poolinfo.POOLBITS) {
int nwords = min_t(int,
@@ -1284,7 +1282,7 @@
r->entropy_count = r->poolinfo.POOLBITS;

- xfer_secondary_pool(r, nbytes);
+ xfer_secondary_pool(r, nbytes, tmp);

DEBUG_ENT("%s has %d bits, want %d bits\n",
r == sec_random_state ? "secondary" :
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.019 / U:3.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site