--- "Raghu R. Arur" <rra2002@cs.columbia.edu> wrote: > > If I am not wrong, Rik van Riel wrote the rmap feature > > to do what you are trying to do. You might want to look > > at mm/rmap.c in the 2.5.x source tree to see how you can > > use this feature. > > > > -Ravi. > > > I dont think Rik's rmap does what is needed. I mean > given a page , tell us which process owns the page. > > what rmap does is that is creates a chain of pte_t > for shared pages. This helps us to know all the page table > entries of a shared page. True. But if you want to do anything with those chained PTE's, there should be a way to lock the page table of the process to which the PTE belongs, right? So I assumed there will be some way to reach the task structure from the PTE. But I looked at the code and found I was wrong. From the chained PTE, you can get to the corresponding task's mm_struct. And page_table_lock, which rmap needs, is a member of mm_struct. So there is no need to get to the task structure. mm_struct does not point back to any task strucutre, possibly because it can be shared across threads. Without this, page-->process mapping is difficult. (But it is a lot easier now: instead of scanning the page table of every process, one loop over the task list to see which task points to the required mm_struct is sufficient. Ugly, but still...) -Ravi. __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/