Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2015 08:44:57 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Hans Petter Selasky <hselasky@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r281644 - head/sys/dev/usb/video
Message-ID:  <2107439.xSp98Qc672@ralph.baldwin.cx>
In-Reply-To: <201504170707.t3H777HV089365@svn.freebsd.org>
References:  <201504170707.t3H777HV089365@svn.freebsd.org>

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



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