Hi,

I am wondering if it would be possible to inherit a library mapping across exec 
and reduce like this the number of mmaps and munmaps. 

Solaris' man page for exec says that it unmaps every existing mmap'ing. 
Opengroup's man page doesn't state anything concerning mmaps in exec(2). So 
this behavior does not seem to be required. 

Wouldn't it be possible for exec to preserve the mmaping of at least some 
libraries (e.g. libc, libm) or parts of them (i.e. the executable pages) and 
reduce the amount of work that the dynamic linker has to do. Especially the 
number of unmaps could be reduced which are very expensive on multiprocessor 
systems. Maybe this would give a little speedup to those ./configure scripts...

Consider $ truss /bin/true
execve("/usr/bin/true", 0xFFBFEC0C, 0xFFBFEC14)  argc = 1
resolvepath("/usr/lib/ld.so.1", "/lib/ld.so.1", 1023) = 12
resolvepath("/usr/bin/true", "/usr/bin/true", 1023) = 13
stat("/usr/bin/true", 0xFFBFE9E8)               = 0
open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
stat("/lib/libc.so.1", 0xFFBFE508)              = 0
resolvepath("/lib/libc.so.1", "/lib/libc.so.1", 1023) = 14
open("/lib/libc.so.1", O_RDONLY)                = 3
mmap(0x00010000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 
0xFF3A0000
mmap(0x00010000, 991232, PROT_NONE, 
MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF280000
mmap(0xFF280000, 881621, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 
3, 0) = 0xFF280000
mmap(0xFF368000, 29469, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 884736) = 0xFF368000
mmap(0xFF370000, 2592, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0xFF370000
munmap(0xFF358000, 65536)                       = 0
memcntl(0xFF280000, 139692, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(3)                                        = 0
munmap(0xFF3A0000, 8192)                        = 0
mmap(0x00010000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF3A0000
getcontext(0xFFBFE6E0)
getrlimit(RLIMIT_STACK, 0xFFBFE6C0)             = 0
getpid()                                        = 14153 [14152]
setustack(0xFF3A2088)
_exit(0)

Any ideas, thoughts, or comments?

Tom
 
 
This message posted from opensolaris.org

Reply via email to