Date: Tue, 31 Jan 2006 12:22:55 +0530 From: "Kamal R. Prasad" <kamalpr@gmail.com> To: Bharma Ji <bharmaji@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: How to pin a userland page in memory(avoid copyin and copyout) Message-ID: <ac7deb50601302252u5d1d1efftf22f084a83e5e08b@mail.gmail.com> In-Reply-To: <67beabb0601301146h6c5034fao998bf573f1e89613@mail.gmail.com> References: <67beabb0601301146h6c5034fao998bf573f1e89613@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1/31/06, Bharma Ji <bharmaji@gmail.com> 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= " >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ac7deb50601302252u5d1d1efftf22f084a83e5e08b>