mmap device-drivers

Konstantin Belousov kostikbel at gmail.com
Tue Mar 14 09:47:32 UTC 2017


On Tue, Mar 14, 2017 at 10:09:05AM +0100, Manuel St?hn wrote:
> Hi,
> is it possible for a device driver to keep track if there are still
> active mmap() pointers pointing to that device?
>   
> Linux does have something like
>   
> struct vm_operations_struct vm_ops =
> {
>                 .close = vm_close,
> };
>   
> where vm_close gets called when any mmapped pointer goes out of scope and the
> driver can refcount the mappers.
>   
> Is there something similar in freebsd?

Look at the OBJT_MGTDEVICE pager.  It allows device drivers to use managed
pages for mappings, which is exactly what you want from the FreeBSD VM.
Managed device pagers are currently utilized by drm and xen code, read
the source for examples.


More information about the freebsd-hackers mailing list