Remove misleading kPageSize dependency am: e90c80308e am: d6a151324c am: 108472e790
Original change: https://android-review.googlesource.com/c/platform/art/+/2193722
Change-Id: I7e7d78f441c27b9b68a4a8e1d17a7302c5b1f032
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/runtime/monitor_pool.h b/runtime/monitor_pool.h
index e07aa97..133cde0 100644
--- a/runtime/monitor_pool.h
+++ b/runtime/monitor_pool.h
@@ -189,12 +189,12 @@
// Size of a monitor, rounded up to a multiple of alignment.
static constexpr size_t kAlignedMonitorSize = (sizeof(Monitor) + kMonitorAlignment - 1) &
-kMonitorAlignment;
- // As close to a page as we can get seems a good start.
- static constexpr size_t kChunkCapacity = kPageSize / kAlignedMonitorSize;
- // Chunk size that is referenced in the id. We can collapse this to the actually used storage
- // in a chunk, i.e., kChunkCapacity * kAlignedMonitorSize, but this will mean proper divisions.
- static constexpr size_t kChunkSize = kPageSize;
+ // Size of the chunks holding the actual monitors. The bottom bits of the monitor id are the
+ // index into such a chunk. We can collapse this to the actually used storage
+ // in a chunk, i.e., kChunkCapacity * kAlignedMonitorSize, but this would mean proper divisions.
+ static constexpr size_t kChunkSize = 4096;
static_assert(IsPowerOfTwo(kChunkSize), "kChunkSize must be power of 2");
+ static constexpr size_t kChunkCapacity = kChunkSize / kAlignedMonitorSize;
// The number of chunks of storage that can be referenced by the initial chunk list.
// The total number of usable monitor chunks is typically 255 times this number, so it
// should be large enough that we don't run out. We run out of address bits if it's > 512.
@@ -215,7 +215,7 @@
// Array of pointers to lists (again arrays) of pointers to chunks containing monitors.
// Zeroth entry points to a list (array) of kInitialChunkStorage pointers to chunks.
// Each subsequent list as twice as large as the preceding one.
- // Monitor Ids are interpreted as follows:
+ // Monitor Ids are effectively interpreted as follows:
// Top 3 bits (of 28): index into monitor_chunks_.
// Next 16 bits: index into the chunk list, i.e. monitor_chunks_[i].
// Last 9 bits: offset within chunk, expressed as multiple of kMonitorAlignment.