From owner-svn-src-head@FreeBSD.ORG Fri Apr 17 12:59:02 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 382D4CED; Fri, 17 Apr 2015 12:59:02 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E890ECC4; Fri, 17 Apr 2015 12:59:01 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5B491B93A; Fri, 17 Apr 2015 08:59:00 -0400 (EDT) From: John Baldwin To: Hans Petter Selasky 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 Date: Fri, 17 Apr 2015 08:44:57 -0400 Message-ID: <2107439.xSp98Qc672@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <201504170707.t3H777HV089365@svn.freebsd.org> References: <201504170707.t3H777HV089365@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 17 Apr 2015 08:59:00 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 12:59:02 -0000 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