Messages in this thread | | | Date | Wed, 20 Nov 2002 14:42:32 -0600 | From | Oliver Xymoron <> | Subject | Re: the random driver |
| |
On Tue, Nov 19, 2002 at 11:46:53PM -0800, Andrew Morton wrote: > > I'm seeing a context switch rate of 150/sec just writing a > big file to disk at 20 megabytes/sec. > > It is coming out of add_disk_randomness()'s invokation of > batch_entropy_store().
First off, there's very little unobservable randomness in those disk ops, especially in a file/webserver context, so the value of add_disk_randomness is questionable.
> That function is setting up deferred punt-to-process-context > for every disk request, and has the potential to cause 1000 > context switches per second. This is clearly excessive. > > There is a 256 slot buffer in the random driver for this, > and we are not using it at all effectively. I do intend > to submit the below patch which will cause one context switch > per 128 requests.
Done that.
> But this is a minimal fix. The batch_entropy_pool handling > in there needs work. > > a) It's racy. The head and tail pointers have no SMP protection > and a race will cause it to dump 128 already-processed items > back into the entropy pool.
I have a rewrite that fails safe and is lockless. But this is nothing compared to the completely broken entropy accounting in xfer_secondary_pool. Try this: cat /dev/random, wait for it to block, and then tap your mouse.
> d) It's punting work up to process context which could be performed > right there in interrupt context.
Disagree. Did you look at the mixing function? It'll dirty a large chunk of cache.
-- "Love the dolphins," she advised him. "Write by W.A.S.T.E.." - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |