[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D5840F6.8030401@ens-lyon.org>
Date: Sun, 13 Feb 2011 21:37:10 +0100
From: Brice Goglin <Brice.Goglin@...-lyon.org>
To: Nikolaus Rath <Nikolaus@...h.org>
CC: LKML <linux-kernel@...r.kernel.org>
Subject: Re: virt_to_page for userspace pointers
Le 13/02/2011 21:24, Nikolaus Rath a écrit :
> On 02/05/2011 04:36 PM, Brice Goglin wrote:
>
>>> Is there an equivalent function to virt_to_page (and virt_to_phys) that
>>> works with userspace pointers? Or do I have to manually walk through the
>>> page tables? In the later case, are there any examples of this kind of
>>> search that I could use as a basis?
>>>
>>>
>> You probably want get_user_pages() (or get_user_pages_fast()).
>>
> Thanks for the pointer, that already helped a lot!
>
> I would, however, prefer a more primitive function that just gives me
> the struct page without locking it. And if the page is swapped out, I'd
> rather get a NULL pointer than having a page frame allocated. Is there
> anything like that?
>
If you don't lock the page, you have no guarantee that it won't get
swapped out or migrated while you look at the physical page.
Brice
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists