From: Nikolaus Rath <Nikolaus@rath.org>
To: Brice Goglin <Brice.Goglin@ens-lyon.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: virt_to_page for userspace pointers
Date: Sun, 13 Feb 2011 16:56:12 -0500 [thread overview]
Message-ID: <4D58537C.3020409@rath.org> (raw)
In-Reply-To: <4D5840F6.8030401@ens-lyon.org>
On 02/13/2011 03:37 PM, Brice Goglin wrote:
> 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.
That's fine, I know that if the page is there at all then it has been
locked by a (different) kernel driver. Is there any way to find out what
I want?
Thanks,
-Nikolaus
--
»Time flies like an arrow, fruit flies like a Banana.«
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
next prev parent reply other threads:[~2011-02-13 21:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-03 20:50 Reversing a memory mapping? Nikolaus Rath
2011-02-05 21:04 ` virt_to_page for userspace pointers (was: Reversing a memory mapping?) Nikolaus Rath
2011-02-05 21:36 ` virt_to_page for userspace pointers Brice Goglin
2011-02-13 20:24 ` Nikolaus Rath
2011-02-13 20:37 ` Brice Goglin
2011-02-13 21:56 ` Nikolaus Rath [this message]
2011-02-13 22:06 ` Alan Cox
2011-02-13 22:11 ` Nikolaus Rath
2011-02-14 22:46 ` Nikolaus Rath
2011-07-26 12:03 ` Alexey Skidanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D58537C.3020409@rath.org \
--to=nikolaus@rath.org \
--cc=Brice.Goglin@ens-lyon.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.