* How to retrieve page pointer from vm_area_struct?
@ 2011-04-17 16:34 Park Chan ho
2011-04-17 19:22 ` Rajat Sharma
0 siblings, 1 reply; 2+ messages in thread
From: Park Chan ho @ 2011-04-17 16:34 UTC (permalink / raw)
To: kernelnewbies
Hi all,
I want to retrieve "struct page" pointer from vm_area_struct.
How do I write code below example?
------------example code------------
struct task_struct *p;
struct vm_area_struct *vma;
struct page *page;
for_each_process(p) {
if (!p->mm) continue;
for (vma = p->mm->mmap; vma; vma = vma->vm_next) {
for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) {
/* How to get page pointer? */
page = ???
}
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* How to retrieve page pointer from vm_area_struct?
2011-04-17 16:34 How to retrieve page pointer from vm_area_struct? Park Chan ho
@ 2011-04-17 19:22 ` Rajat Sharma
0 siblings, 0 replies; 2+ messages in thread
From: Rajat Sharma @ 2011-04-17 19:22 UTC (permalink / raw)
To: kernelnewbies
use get_user_pages, this function works on vma and pin pages in memory
as well, typically used by filesystem Direct I/O implementation.
Thanks,
Rajat
On Sun, Apr 17, 2011 at 9:34 AM, Park Chan ho <parkch98@gmail.com> wrote:
> Hi all,
> I want to retrieve "struct page" pointer from vm_area_struct.
> How do I write code below example?
>
> ------------example code------------
> struct task_struct *p;
> struct vm_area_struct *vma;
> struct page *page;
>
> for_each_process(p) {
> ? ?if (!p->mm) continue;
> ? ?for (vma = p->mm->mmap; vma; vma = vma->vm_next) {
> ? ? ? for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) {
> ? ? ? ? ? ?/* How to get page pointer? */
> ? ? ? ? ? ?page = ???
> ? ? ? }
> ? ?}
> }
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-17 19:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-17 16:34 How to retrieve page pointer from vm_area_struct? Park Chan ho
2011-04-17 19:22 ` Rajat Sharma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).