runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Relocation strategy for mscorlib.ni.dll

Open papaslavik opened this issue 10 years ago • 5 comments

Testing a trivial application on Linux x64 with mscorlib.ni.dll reveals that a large amount of memory is counted as Private_Dirty after PEImageLayout::ApplyBaseRelocations() is called.

7f3dc749e000-7f3dc7a53000 rw-p 00001000 08:01 7871311 /home/wvoquine/coreclr-demo/runtime/mscorlib.ni.dll Private_Dirty: 2820 kB

7f3dc7a74000-7f3dc81ff000 r-xp 005d7000 08:01 7871311 /home/wvoquine/coreclr-demo/runtime/mscorlib.ni.dll Private_Dirty: 1012 kB

Are there any current plans to reduce the relocation impact to dirty memory?

papaslavik avatar Apr 27 '16 12:04 papaslavik

cc @jkotas @JohnChen0

pgavlin avatar Apr 27 '16 19:04 pgavlin

cc @janvorli @gkhanna79 Another place where not having native platform images is hurting us.

We could consider switching over to R2R image even for mscorlib to mitigate the dirty memory hit, but it will cause more JITing. @JohnChen0 Could you please take a look at this once the generic support for R2R is implemented? We should understand the startup time hit from doing so.

jkotas avatar Apr 27 '16 20:04 jkotas

It looks like the problem is present only on AMD64 due to the following code in MAPMapPEFile():


#if !defined(_AMD64_)
    loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON, -1, 0);
#else // defined(_AMD64_)    
    // First try to reserve virtual memory using ExecutableAllcator. This allows all PE images to be
    // near each other and close to the coreclr library which also allows the runtime to generate
    // more efficient code (by avoiding usage of jump stubs).
    loadedBase = ReserveMemoryFromExecutableAllocator(virtualSize);
    if (loadedBase == NULL)
    {
        // MAC64 requires we pass MAP_SHARED (or MAP_PRIVATE) flags - otherwise, the call is failed.
        // Refer to mmap documentation at http://www.manpagez.com/man/2/mmap/ for details.
        loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
    }
#endif // !defined(_AMD64_)

papaslavik avatar May 04 '16 13:05 papaslavik

We will look into this post-RTM.

gkhanna79 avatar May 10 '16 19:05 gkhanna79

@jkotas should this issue still be open?

jkoritzinsky avatar Mar 04 '20 04:03 jkoritzinsky