From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 31 07:47:41 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 537FC16A422 for ; Tue, 31 Jan 2006 07:47:41 +0000 (GMT) (envelope-from kamalpr@gmail.com) Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 848FB43D45 for ; Tue, 31 Jan 2006 07:47:40 +0000 (GMT) (envelope-from kamalpr@gmail.com) Received: by uproxy.gmail.com with SMTP id e2so133199ugf for ; Mon, 30 Jan 2006 23:47:39 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=okNEyojIbWpVn8LlIXvRTZ/fZKwgidRk/gnH8CVrytZggJk7Luik7ncehBKAh1OOmAJwXbhP1ttIHIOoMP2B5ccUxODeMRG89om8RddP/pjE1i40NEBh4Aqu/If3S0oa/ADWjufcr2ahbA63H9RGlr0Bm64qGVg//07hFc8AGYc= Received: by 10.48.244.4 with SMTP id r4mr1218571nfh; Mon, 30 Jan 2006 22:52:55 -0800 (PST) Received: by 10.49.14.17 with HTTP; Mon, 30 Jan 2006 22:52:55 -0800 (PST) Message-ID: Date: Tue, 31 Jan 2006 12:22:55 +0530 From: "Kamal R. Prasad" To: Bharma Ji In-Reply-To: <67beabb0601301146h6c5034fao998bf573f1e89613@mail.gmail.com> MIME-Version: 1.0 References: <67beabb0601301146h6c5034fao998bf573f1e89613@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: How to pin a userland page in memory(avoid copyin and copyout) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: kamalp@acm.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2006 07:47:41 -0000 On 1/31/06, Bharma Ji wrote: > > Hi > I am trying to explore the option avoiding copyin and copyout when mode > switches from user to kernel and vice versa. One way to achieve this, as = I > understand, is to make the memory address (which contain the data to be > copied) non pageable. Then just pass the addresses to the kernel and the > data will be used directly from the userland page. Is there already some > example code / standard way to do this? The only way Im aware is to mmap() a file. The vtophys() translation will b= e different for kernel and userspace -but there will be no copyin()/copyout(= ) involved. Also is there any way one can determine the amount of time / performance hi= t > (CPU %)that happening on a given process due to the copyin and copyout. I > want to understand how much performance gain one can gain if I am able to > remove copyin/copyout. It has an overhead both in copying data as well as using 2x the amt of memory required. If you just need to pass parameters, copyin()/out() works fine. If you want to read a multimedia device or pass some other huge block of memory across address spaces, then mmap() helps. FYI -there is an mmap() method supported by usb driver frameworks. regards -kamal _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " >