LWN: Comments on "Driver porting: Zero-copy user-space access" https://lwn.net/Articles/28548/ This is a special feed containing comments posted to the individual LWN article titled "Driver porting: Zero-copy user-space access". en-us Wed, 15 Oct 2025 21:32:13 +0000 Wed, 15 Oct 2025 21:32:13 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Driver porting: Zero-copy user-space access https://lwn.net/Articles/549723/ https://lwn.net/Articles/549723/ Ajaxelitus <div class="FormattedComment"> Another, much more modern and very tiny example may be found at<br> <p> <a href="https://gist.github.com/17twenty/2930467">https://gist.github.com/17twenty/2930467</a><br> </div> Wed, 08 May 2013 21:37:13 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/323236/ https://lwn.net/Articles/323236/ will <div class="FormattedComment"> <font class="QuotedText">&gt; For a good example of how to use get_user_pages() in a char driver, see the definition of sgl_map_user_pages() in drivers/scsi/st.c.</font><br> </div> Fri, 13 Mar 2009 18:26:12 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/311949/ https://lwn.net/Articles/311949/ bmasood <div class="FormattedComment"> Bart,<br> <p> I am facing the exact problem that you mentioned: Need to get my data from device to user space as efficiently as possible. I was wondering if you did find any example?<br> <p> Thanks<br> Bilal<br> <p> </div> Thu, 18 Dec 2008 06:37:17 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/248605/ https://lwn.net/Articles/248605/ dnevil Try booting with a kernel parameter of "highmem=0".<br> Thu, 06 Sep 2007 16:31:02 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/248564/ https://lwn.net/Articles/248564/ dnevil Sounds like your system is allocating memory from ZONE_HIGHMEM (since you are on a heavily loaded system, and you are probably running i386). The comments in include/linux/mm_types states that if page-&gt;virtual is null then the page is not mapped into kernel virtual memory (i.e. it is HIGHMEM). You should try allocating your memory as soon after system boot as possible. Are there other 'tricks' for assuring that user-allocated memory comes from ZONE_NORMAL or ZONE_DMA?<br> Thu, 06 Sep 2007 15:28:13 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/242359/ https://lwn.net/Articles/242359/ bartjes As I am quite new with Linux, searching the entire morning to find a solution for getting data out of my driver to a user application as efficient as possible, I stumble accross deprecanted mechanisms, function prototypes, and sometimes even a bit of explanation.<br> All this looks very complex to me and I REALLY could use a basic example where a piece of shared memory is allocated, freed, passed from driver to user-spacve or vice versa, and how the driver fills information into the structure and how the user process can read this.<br> <p> It's sad that while searching all morning, an example is nowhere to be found, or it's way too complicated to understand, does compile with my terminal full of errors.....<br> <p> Any suggestion would be helpful, Thanks, Bart<br> Fri, 20 Jul 2007 12:43:48 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/236653/ https://lwn.net/Articles/236653/ yltian Please "grep get_user_pages linux/drivers/media/video/video-buf.c". It's a good example. V4L2 uses this method to share memory betweent DMA and application.<br> Sat, 02 Jun 2007 01:48:11 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/172130/ https://lwn.net/Articles/172130/ ceb Does anyone have any experience in using get_user_pages in a real system. As far as I can tell it is totally unreliable when the machine is in any way loaded. As well as getting zero addresses for pages returned, the physical addresses don't seem to correspond to the data to be transferred. This is on various flavors of Linux 2.6 based kernels. <br> <br> This seems to rule out performing DMA directly from user space but I would like to be told that I'm wrong. <br> <p> Wed, 15 Feb 2006 17:17:47 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/158185/ https://lwn.net/Articles/158185/ rwbowman TRUE or FALSE - if I map and lock a user space buffer using get_user_pages during ioctl, and then allow the ioctl to return, the pages will remnain locked until I release them with page_cache_release. <br> <p> I've heard (twice now) where folks say they don't remain locked.?<br> Thanks!<br> <p> Wed, 02 Nov 2005 21:29:42 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/73943/ https://lwn.net/Articles/73943/ bhepple Hmmm, a quick recursive grep through the 2.6.3 driver source and include files showed exactly 0 users of set_page_dirty_lock() and 1 user of put_page() (in drivers/char/agp/generic.c)<p>There _is_ a <br>#define page_cache_release(page) put_page(page)<br>in include/linux/pagemap.h and it is quite a popular little chap in the device driver code with 13 hits in the entire tree.<p>Am I missing something or should we be using page_cache_release instead of put_page and is it (and set_page_dirty_lock) _really_ needed after all - I can hardly believe all those drivers are causing &quot;data corruption and grumpy users&quot;...<p> Wed, 03 Mar 2004 07:55:24 +0000 Driver porting: Zero-copy user-space access https://lwn.net/Articles/71057/ https://lwn.net/Articles/71057/ grisu1976 I don't really understand why the kiobuf interface does not exist anymore. In linux kernel 2.4 the kiobuf interface used get_user_pages, or am i wrong? The kiobuf interface was easier to use than get_user_pages - that's my opinion Fri, 13 Feb 2004 14:34:34 +0000