rts: Inform kernel that we won't need reserved address space
ClosedPublic

Authored by bgamari on Sep 8 2017, 8:38 AM.

Details

Summary

Trac Trac #14192 points out that currently GHC's two-step allocator results in
extremely large coredumps. It seems like WebKit may have encountered similar
issues and their apparent solution uses madvise(MADV_DONTNEED) while reserving
address space to inform the kernel that the address space we just requested
needs no backing. Perhaps this is used by the core dump logic to trim out
uncommitted pages.

Test Plan

Validate, try core-dumping a compiled executable

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari created this revision.Sep 8 2017, 8:38 AM

Thanks! Does this fix the problem? We should check whether it helps when disabling overcommit too.

bgamari updated this revision to Diff 13813.Sep 11 2017, 7:55 AM

Also set MADV_DONTDUMP

bgamari added a comment.EditedSep 11 2017, 7:55 AM

Thanks! Does this fix the problem? We should check whether it helps when disabling overcommit too.

Unfortunately not in gdb, even with gdb master. It seems that even MADV_DONTDUMP doesn't do the trick. This will require more investigation.

bgamari updated this revision to Diff 14087.Sep 25 2017, 8:24 AM

don't treat madvise argument as a bitmap

Indeed this now works.

bgamari retitled this revision from [WIP] rts: Inform kernel that we won't need reserved address space to rts: Inform kernel that we won't need reserved address space.Sep 25 2017, 8:27 AM
simonmar accepted this revision.Sep 25 2017, 9:08 AM
This revision is now accepted and ready to land.Sep 25 2017, 9:08 AM
This revision was automatically updated to reflect the committed changes.