Getting struct page pointer from virtual address

Peter Teoh htmldeveloper at gmail.com
Thu Sep 12 19:46:27 EDT 2013


I think there is no exported function for that, but there is a global
variable for that.   Reason being for performance - the action
virt_to_phys() is a macro to be compiled inline and more details here:

http://stackoverflow.com/questions/5982125/how-to-get-a-struct-page-from-any-address-in-the-linux-kernel


On Wed, Sep 4, 2013 at 1:29 AM, ajay saini <ajay_saini1006 at yahoo.co.in>wrote:

> More information :
> - Linux kernel version : 2.6.32 (But I would like a method which is
> portable to other higher versions as well)
> - I tried using follow_page, but this function is not exported from the
> kernel so, can't use it. (Any reason why this function is not exported??)
>
> Thanks
> Ajay
>
>   ------------------------------
>  *From:* ajay saini <ajay_saini1006 at yahoo.co.in>
> *To:* "kernelnewbies at kernelnewbies.org" <kernelnewbies at kernelnewbies.org>
> *Sent:* Tuesday, 3 September 2013 1:21 PM
> *Subject:* Getting struct page pointer from virtual address
>
> Hey,
>
> I am working on a linux kernel module and I have a virtual address and mm
> (struct mm_struct) for a process in this module. I can find the virtaul
> memory area to which this address belongs to by using find_vma.
>
> Is there a function in the linux kernel which I can use in this module
> (i.e. exported from the kernel) to get struct page pointer for this virtual
> address.
>
> Thanks
> Ajay
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130913/4007f32d/attachment.html 


More information about the Kernelnewbies mailing list