Commit b2e92a52 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Reduce context switch rate due to the random driver

add_disk_randomness() is causing a context switch per disk request.  It
is scheduling process-context work one timer tick in the future for
every request.

But is has a buffer for this, so change it to not set up the
process-context work until that buffer is half full.

The patch reduces the context switch rate during a 20 megabyte/sec
write to scsi from 150/sec to 50/sec.
parent a93e679a
......@@ -660,14 +660,16 @@ void batch_entropy_store(u32 a, u32 b, int num)
batch_entropy_credit[batch_head] = num;
new = (batch_head+1) & (batch_max-1);
if (new != batch_tail) {
if ((unsigned)(new - batch_tail) >= (unsigned)(batch_max / 2)) {
/*
* Schedule it for the next timer tick:
*/
schedule_delayed_work(&batch_work, 1);
batch_head = new;
} else {
} else if (new == batch_tail) {
DEBUG_ENT("batch entropy buffer full\n");
} else {
batch_head = new;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment