Chris Trobridge(deleted)
|
Optimising VM translation in device drivers
|
Chris Trobridge(deleted)
06/23/2010 11:29 AM
post57694
|
Optimising VM translation in device drivers
When I was testing a bus-mastering device I found that the calls to mmap to produce buffer descriptors was becoming a
major overhead at high transaction rates.
Using buffers that are pre-mapped removes this overhead (it's performed once during driver initialisation) but this
isn't a solution for cases where it's not practical to copy data in and out of these buffers.
The thought I've had is to build up a cache of mmap entries. This combines the efficiency of pre-computing the mmap
translation while still allowing the use of any memory within the process, with the (hopefully) smaller cost of a
looking up the translation in the cache.
The one concern I have with this is the consequence of the mmap translation changing. This is an embedded system with
no paging to disk so I think this would only occur if unused virtual memory is released to the system and then later
reallocated. I don't seem why QNX would move process memory around in RAM otherwise.
The consequence of the mapping changing with a bus mastering device would be catastrophic so there would need to be a
guarantee that memory mapping would be constant.
Or is there a better approach to an efficient bus-mastering driver that avoids the overhead of mmap on each call?
Regards.
|
|
|