Skip to contentSkip to conversation

locking user space memory in kernel

DISCUSSION Ross Dickson 1 participant 1 message Apr 8, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 20 lines · Libor Michalek

----- Forwarded message from Manfred Spraul <[email protected]> -----

Quoted 6 lines

Date: Sun, 21 Mar 2004 12:31:59 +0100
From: Manfred Spraul <[email protected]>
To: Eli Cohen <[email protected]>
Cc: [email protected]
Subject: Re: locking user space memory in kernel

Quoted 10 lines

Hi Eli,

I think just get_user_pages() should be sufficient: the pages won't be swapped out. You don't need to set VM_LOCKED in vma->vm_flags to prevent the swap out. In the worst case, the pte is cleared a that will cause a soft page fault, but the physical address won't change. Multiple get_user_pages() calls on overlapping regions are ok, the page count is an atomic_t, at least 24-bit large.

Quoted 7 lines

The soft page fault is a problem if the device is going to write data into the buffer and then notify the user that the buffer now contains valid data. If the soft page fault occurs before the device has written to the page list, once the user is notified of the write and reads the buffer, it will no longer be the same pages as the ones to which the device wrote.

I know of an open source driver for image acquisition cards iti-fg that does "PAGEWISE transfer of image frames directly into user space". The release notes mention the memory locking.

It is available here
http://oss.gom.com/

Regards
Ross.