Merge "Unify names for pages allocated for small objects" am: eecae0a359

am: cdf8d292f3

* commit 'cdf8d292f3cc12516f808f1a341df1a9194adcbd':
  Unify names for pages allocated for small objects
This commit is contained in:
Dimitry Ivanov 2016-01-27 02:33:44 +00:00 committed by android-build-merger
commit 116b57f0ec
2 changed files with 5 additions and 17 deletions

View file

@ -70,7 +70,7 @@ static inline uint16_t log2(size_t number) {
}
LinkerSmallObjectAllocator::LinkerSmallObjectAllocator()
: type_(0), name_(nullptr), block_size_(0), free_pages_cnt_(0), free_blocks_list_(nullptr) {}
: type_(0), block_size_(0), free_pages_cnt_(0), free_blocks_list_(nullptr) {}
void* LinkerSmallObjectAllocator::alloc() {
if (free_blocks_list_ == nullptr) {
@ -156,10 +156,9 @@ void LinkerSmallObjectAllocator::free(void* ptr) {
}
}
void LinkerSmallObjectAllocator::init(uint32_t type, size_t block_size, const char* name) {
void LinkerSmallObjectAllocator::init(uint32_t type, size_t block_size) {
type_ = type;
block_size_ = block_size;
name_ = name;
}
linker_vector_t::iterator LinkerSmallObjectAllocator::find_page_record(void* ptr) {
@ -197,7 +196,7 @@ void LinkerSmallObjectAllocator::alloc_page() {
__libc_fatal("mmap failed");
}
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, map_ptr, PAGE_SIZE, name_);
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, map_ptr, PAGE_SIZE, "linker_alloc_small_objects");
memset(map_ptr, 0, PAGE_SIZE);
@ -220,19 +219,9 @@ void LinkerSmallObjectAllocator::alloc_page() {
LinkerMemoryAllocator::LinkerMemoryAllocator() {
static const char* allocator_names[kSmallObjectAllocatorsCount] = {
"linker_alloc_16", // 2^4
"linker_alloc_32", // 2^5
"linker_alloc_64", // and so on...
"linker_alloc_128",
"linker_alloc_256",
"linker_alloc_512",
"linker_alloc_1024", // 2^10
};
for (size_t i = 0; i < kSmallObjectAllocatorsCount; ++i) {
uint32_t type = i + kSmallObjectMinSizeLog2;
allocators_[i].init(type, 1 << type, allocator_names[i]);
allocators_[i].init(type, 1 << type);
}
}

View file

@ -101,7 +101,7 @@ typedef
class LinkerSmallObjectAllocator {
public:
LinkerSmallObjectAllocator();
void init(uint32_t type, size_t block_size, const char* name);
void init(uint32_t type, size_t block_size);
void* alloc();
void free(void* ptr);
@ -113,7 +113,6 @@ class LinkerSmallObjectAllocator {
void create_page_record(void* page_addr, size_t free_blocks_cnt);
uint32_t type_;
const char* name_;
size_t block_size_;
size_t free_pages_cnt_;