From owner-freebsd-arch@FreeBSD.ORG Wed Aug 29 09:23:26 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BA281065676; Wed, 29 Aug 2012 09:23:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id C42498FC08; Wed, 29 Aug 2012 09:23:25 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q7T9NU4Q016140; Wed, 29 Aug 2012 12:23:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q7T9NIoK071714; Wed, 29 Aug 2012 12:23:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q7T9NIGa071713; Wed, 29 Aug 2012 12:23:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Aug 2012 12:23:18 +0300 From: Konstantin Belousov To: Don Lewis Message-ID: <20120829092318.GW33100@deviant.kiev.zoral.com.ua> References: <503DD433.2030108@FreeBSD.org> <201208290906.q7T96C9j032802@gw.catspoiler.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DGJeRcv3Pogw2aF5" Content-Disposition: inline In-Reply-To: <201208290906.q7T96C9j032802@gw.catspoiler.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua 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) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 09:23:26 -0000 --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--