Commit graph

8 commits

Author SHA1 Message Date
Vic Yang
fb78a4ac1b linker: Purge block allocator memory when possible
If all allocated memory from a block allocator is freed, it is a good
opportunity to purge all the pages allocated to reduce lingering dirty
pages.

Memory saving varies with the platform and what processes are running.
Measuring right after boot, this saves ~1.8MB on cuttelfish and ~1.3MB
on a 32-bit ARM device.

Bug: 112073665
Test: Boot and check memory usage with 'showmap'.
Change-Id: I53769e0ec9699f0b3645cdf281a2c0bbffb98676
2019-01-23 12:24:46 -08:00
Elliott Hughes
99d54656bd Add PR_SET_VMA and PR_SET_VMA_ANON_NAME to <sys/prctl.h>.
We've copied & pasted these to too many places. And if we're going to
have another go at upstreaming these, that's probably yet another reason
to have the *values* in just one place. (Even if upstream wants different
names, we'll likely keep the legacy names around for a while for source
compatibility.)

Bug: http://b/111903542
Test: ran tests
Change-Id: I8ccc557453d69530e5b74f865cbe0b458c84e3ba
2018-08-22 10:36:23 -07:00
Elliott Hughes
7b0af7ad82 Always log errno when aborting.
(Where errno is relevant.)

Also consistently use -1 as the fd for anonymous mmaps. (It doesn't matter,
but it's more common, and potentially more intention-revealing.)

Bug: http://b/65608572
Test: ran tests
Change-Id: Ie9a207632d8242f42086ba3ca862519014c3c102
2017-09-15 16:18:49 -07:00
Dimitry Ivanov
bcc4da9b75 Unify linker files under one license (BSD)
Historically we had part of the linker licensed under BSD and
another part under Apache 2 license. This commit makes all the
linker code licensed under BSD license.

Test: m
Change-Id: I11b8163ae75966b5768d3fe992679de376106515
2017-02-15 15:35:33 -08:00
Dimitry Ivanov
8cbe97de7f Remove unnecessary memsets in linker allocators
Test: linker-unit-tests
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I96f983dba77c9cb5698a9eb2e51b33bc128c6dd7
2017-02-09 15:53:54 -08:00
Dimitry Ivanov
3edc5c41bb linker: align allocated blocks to 16 bytes
C/C++ requires the result of malloc/new to be
aligned for any primitive type.

Change-Id: I715b7679e738f34b3b409993fb3ef242e1321b7f
2016-01-21 14:28:33 -08:00
Dmitriy Ivanov
600bc3cb93 Rename LinkerAllocator and LinkerAllocatorPage
Change-Id: I87d80fbcd4ec26c0ee4f601b9c4c64f600418dd9
2015-03-10 15:43:50 -07:00
Dmitriy Ivanov
c9ce70d783 Refactoring: rename linker_allocator files
Change-Id: Ifc08e64b3a85205f072b7abab1149c7ab71e2f75
2015-03-10 15:30:26 -07:00
Renamed from linker/linker_allocator.cpp (Browse further)