Commit 81297f9d authored by Jeff Garzik's avatar Jeff Garzik

Remove performance barrier in i810_rng char driver.

  
In order to conserve CPU, the read(2) syscall would schedule_timeout
unconditionally.  This also crippled speed, and was a bad design
decision.  This cset merges the updated read(2) logic of the sister
driver amd768_rng from Alan, which schedules only when it needs to.
  
On my test system, by one microbenmark, read(2) output jumped
from 0.08 kbit/s to "what Intel expects" of 20 kbit/s.
  
End users may notice a significant decrease in idle time after
this change (and a correspondingly large increase in /dev/hwrng user
speed), if /dev/hwrng is used to its maximum capacity.
parent 59a45951
......@@ -27,6 +27,7 @@
#include <linux/miscdevice.h>
#include <linux/smp_lock.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/uaccess.h>
......@@ -243,8 +244,13 @@ static ssize_t rng_dev_read (struct file *filp, char *buf, size_t size,
if (filp->f_flags & O_NONBLOCK)
return ret ? : -EAGAIN;
if (need_resched())
{
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(1);
}
else
udelay(200);
if (signal_pending (current))
return ret ? : -ERESTARTSYS;
......
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