summaryrefslogtreecommitdiff
path: root/linker/linker_block_allocator.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2019-03-11 17:27:52 -0700
committerRyan Prichard <rprichard@google.com>2019-03-12 01:11:24 +0000
commit92b3e1b37b4391318424898bca8d6e9e961f046a (patch)
tree415d99dda50e82f2bba111c1b0aa80e1537e5ddc /linker/linker_block_allocator.cpp
parentb0e2dd090bc74f36e3f2cafe85f542b785d760df (diff)
Cosmetic changes to linker allocator and config
Make the num_free_blocks calculation clearer. There are sizeof(page->bytes) bytes available for blocks, which is equal to (kAllocateSize - 16). The previous calculation overestimates the amount of space by 8 or 12 bytes, but that doesn't change the result because both kAllocateSize and block_size_ are multiples of 16. Bug: none Test: boot device, bionic unit tests Change-Id: Ia880cd5abc2a7bb4e9e6a8c0441d985f4df8fdc4
Diffstat (limited to 'linker/linker_block_allocator.cpp')
-rw-r--r--linker/linker_block_allocator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/linker/linker_block_allocator.cpp b/linker/linker_block_allocator.cpp
index fdb4c8563..1e2f9a2a2 100644
--- a/linker/linker_block_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -134,7 +134,7 @@ void LinkerBlockAllocator::create_new_page() {
FreeBlockInfo* first_block = reinterpret_cast<FreeBlockInfo*>(page->bytes);
first_block->next_block = free_block_list_;
- first_block->num_free_blocks = (kAllocateSize - sizeof(LinkerBlockAllocatorPage*))/block_size_;
+ first_block->num_free_blocks = sizeof(page->bytes) / block_size_;
free_block_list_ = first_block;