Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2017 11:47:26 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Manuel St?hn <freebsdnewbie@freenet.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: mmap device-drivers
Message-ID:  <20170314094726.GB16105@kib.kiev.ua>
In-Reply-To: <20170314090905.GA94880@freebsd-t420.fritz.box>
References:  <20170314090905.GA94880@freebsd-t420.fritz.box>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170314094726.GB16105>