svn commit: r281644 - head/sys/dev/usb/video

John Baldwin jhb at freebsd.org
Fri Apr 17 12:59:02 UTC 2015


On Friday, April 17, 2015 07:07:07 AM Hans Petter Selasky wrote:
> Author: hselasky
> Date: Fri Apr 17 07:07:06 2015
> New Revision: 281644
> URL: https://svnweb.freebsd.org/changeset/base/281644
> 
> Log:
>   Buffers which can be memory mapped into userspace should never be
>   freed. Recycle the buffers instead. This patch also fixes a panic at
>   reboot issue when an UDL adapter is attached to the system.

You can free them safely if you don't use malloc() / free().  Instead, you
could create an OBJT_PHYS object that you wire when you map into the kernel
and export that to userland via d_mmap_single.  In your driver you just
need to unmap the kernel mapping to drop the reference count on the object.
Once the userland processes exit or remove their mappings the pages would
be freed.

-- 
John Baldwin


More information about the svn-src-all mailing list