From mboxrd@z Thu Jan 1 00:00:00 1970 From: fs.rajat@gmail.com (Rajat Sharma) Date: Sun, 17 Apr 2011 12:22:57 -0700 Subject: How to retrieve page pointer from vm_area_struct? In-Reply-To: References: Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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 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 >