Date: Fri, 17 Apr 2015 23:17:30 +0200 From: Hans Petter Selasky <hps@selasky.org> To: John Baldwin <jhb@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: <5531786A.1000900@selasky.org> In-Reply-To: <2107439.xSp98Qc672@ralph.baldwin.cx> References: <201504170707.t3H777HV089365@svn.freebsd.org> <2107439.xSp98Qc672@ralph.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
On 04/17/15 14:44, John Baldwin wrote: > 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. > Hi, If you want to make a patch for UDL as a good example how to do this, please go ahead! I can test the driver is not broken afterwards. --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5531786A.1000900>