Re: doubt regarding VMA

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

 



Dear Raj


> My question is regarding this particular scenario. Consider that a
> process A has mmap'ed the text region of a library libfoo.so. The
> text region will have corresponding VMA in the process which with
> read and execute permissions. Now if another process B does a mmap of
> the same library file it will have its own VMA for the text region.

IMHO that is correct. Different process owns different VMA, but it 
points to the same pages which map to the same shared lib...

> Now how does the process B gets the same pages mapped by process A.
> Is it through the address_space structure that the same pages are
> shared ?

IIRC, page with the help of address_space object is hashed (or inserted 
into a tree?), so at the first time, the kernel finds if the an inode 
which relates to certain file (in this case a shared lib) is already 
mmap-ep or not.

In the case of shared lib, Paul Brook from Qemu community privately gave 
me short explanation (via IRC) that it is also the work of ld.so which 
load and link the shared libs with any executable which need some 
functionalities on the shared libs. He said that ld.so maintains a 
lookup table (?) named GOT/LOT (I don't know what it stands for) that 
helps ld.so to determine which shared lib held a need function and load 
it as neccessary

> Also which function checks whether is already an existing
> address_space structure for a file ?
 I don't know about it, sorry... I am still a beginner on VFS and Linux 
MM. Perhaps Mr Al Viro can provide better enlightenment....

regards

Mulyadi


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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux