[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how pte to struct task_struct ptr via rmap?



<quote sender="Ed L Cashin">
> Arjan van de Ven <arjanv@xxxxxxxxxx> writes:
> 
> > On Fri, 2004-03-05 at 19:25, Ed L Cashin wrote:
> >> Hi.  I read somewhere that seemed authoritative (unfortunately I
> >> forget where) that you could use the rmap stuff to get both the
> >> mm_struct pointer and the task_struct pointer associated with a PTE
> >> given that PTE.
> >> 
> >> I see in mm/rmap.c:try_to_unmap_one that you can use ptep_to_mm to get
> >> the mm.  I think it's pretty neat: the mm pointer is hidden in the
> >> mapping field of the page struct describing the page where the pte
> >> lives.
> >
> > there is a fundamental issue wrt task_struct: there can be *many* of
> > those for any given PTE, since tasks can (and do in the case of threads)
> > share the mm.
> 
> I should have mentioned that I know that multiple threads can share an
> mm.  The question is more general: how to get the owner(s) of the mm.

what i did is to check the clone_flags, and note which tasks share or
do not share the same mm_struct. now, the thing you have to figure out
is to find out how to get the owners in the first place, but i guess
you already figured that one out.

Eugene

> 
> -- 
> --Ed L Cashin            |   PGP public key:
>   ecashin@xxxxxxx        |   http://noserose.net/e/pgp/
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 

-- 
Eugene TEO -  <eugeneteo%null!cc!uic!edu> <http://www.anomalistic.org/>
1024D/14A0DDE5 print D851 4574 E357 469C D308  A01E 7321 A38A 14A0 DDE5
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/