cvs commit: src/sys/dev/random randomdev_soft.c

Robert Watson rwatson at
Sat Oct 9 15:04:13 PDT 2004

rwatson     2004-10-09 22:04:13 UTC

  FreeBSD src repository

  Modified files:
    sys/dev/random       randomdev_soft.c 
  Modify entropy harvesting locking strategy:
  - Trade off granularity to reduce overhead, since the current model
    doesn't appear to reduce contention substantially: move to a single
    harvest mutex protecting harvesting queues, rather than one mutex
    per source plus a mutex for the free list.
  - Reduce mutex operations in a harvesting event to 2 from 4, and
    maintain lockless read to avoid mutex operations if the queue is
  - When reaping harvested entries from the queue, move all entries from
    the queue at once, and when done with them, insert them all into a
    thread-local queue for processing; then insert them all into the
    empty fifo at once.  This reduces O(4n) mutex operations to O(2)
    mutex operations per wakeup.
  In the future, we may want to look at re-introducing granularity,
  although perhaps at the granularity of the source rather than the
  source class; both the new and old strategies would cause contention
  between different instances of the same source (i.e., multiple
  network interfaces).
  Reviewed by:    markm
  Revision  Changes    Path
  1.5       +41 -50    src/sys/dev/random/randomdev_soft.c

More information about the cvs-all mailing list