Date: Wed, 29 Aug 2012 12:23:18 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Don Lewis <truckman@freebsd.org> Cc: alc@freebsd.org, alan.l.cox@gmail.com, avg@freebsd.org, freebsd-arch@freebsd.org, zont@freebsd.org, bryan@shatow.net Subject: Re: [patch] unprivileged mlock(2) Message-ID: <20120829092318.GW33100@deviant.kiev.zoral.com.ua> In-Reply-To: <201208290906.q7T96C9j032802@gw.catspoiler.org> References: <503DD433.2030108@FreeBSD.org> <201208290906.q7T96C9j032802@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--DGJeRcv3Pogw2aF5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 29, 2012 at 02:06:12AM -0700, Don Lewis wrote: > On 29 Aug, Andrey Zonov wrote: >=20 > > But can we do better and don't lock process's memory in sysctl handlers? >=20 > It is necessary to wire the userland buffer to make sure that the sysctl > handler doesn't page fault while it is copying data into or out of the > buffer. The handler may be holding a mutex that protects the kernel > data structure that it is accessing, in which case the handler is not > allowed to block on a page fault. >=20 > If the handler allocated a buffer in kernel memory before grabbing the > mutex, the it would be possible to avoid wiring the userland buffer, but > this would tie up just as much non-pageable memory and an extra data > copy would be required. At least it would not cause a fragmentation of the user map. Another approach could be to use vm_fault_quick_hold_pages() and then use uiomove_fromphys() to copyin/out data inside the handler. This is what currently done by FFS and NFS. --DGJeRcv3Pogw2aF5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlA934UACgkQC3+MBN1Mb4h1QQCgoAz5M0P2Vn1TP/8B99+y3++G 6+QAoLy75FjsJk1QLTKDTfwgFo7Ot1vS =ujrs -----END PGP SIGNATURE----- --DGJeRcv3Pogw2aF5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120829092318.GW33100>