You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/use-sysconf-page-size-on-pp...

61 lines
3.1 KiB

Index: chromium-120.0.6099.71/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
===================================================================
--- chromium-120.0.6099.71.orig/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
+++ chromium-120.0.6099.71/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
@@ -172,7 +172,11 @@ SystemPageBaseMask() {
return ~SystemPageOffsetMask();
}
+#if defined(ARCH_CPU_PPC64)
+constexpr size_t kPageMetadataShift = 6; // 64 bytes per partition page.
+#else
constexpr size_t kPageMetadataShift = 5; // 32 bytes per partition page.
+#endif
constexpr size_t kPageMetadataSize = 1 << kPageMetadataShift;
} // namespace partition_alloc::internal
Index: chromium-120.0.6099.71/base/allocator/partition_allocator/src/partition_alloc/partition_page.h
===================================================================
--- chromium-120.0.6099.71.orig/base/allocator/partition_allocator/src/partition_alloc/partition_page.h
+++ chromium-120.0.6099.71/base/allocator/partition_allocator/src/partition_alloc/partition_page.h
@@ -90,7 +90,11 @@ struct SlotSpanMetadata {
// CHECK()ed in AllocNewSlotSpan().
// The maximum number of bits needed to cover all currently supported OSes.
+#if defined(ARCH_CPU_PPC64)
+ static constexpr size_t kMaxSlotsPerSlotSpanBits = 15;
+#else
static constexpr size_t kMaxSlotsPerSlotSpanBits = 13;
+#endif
static_assert(kMaxSlotsPerSlotSpan < (1 << kMaxSlotsPerSlotSpanBits), "");
// |marked_full| isn't equivalent to being full. Slot span is marked as full
@@ -104,7 +108,11 @@ struct SlotSpanMetadata {
private:
const uint32_t can_store_raw_size_ : 1;
uint32_t freelist_is_sorted_ : 1;
+#if defined(ARCH_CPU_PPC64)
+ uint32_t unused1_ : (64 - 1 - 2 * kMaxSlotsPerSlotSpanBits - 1 - 1);
+#else
uint32_t unused1_ : (32 - 1 - 2 * kMaxSlotsPerSlotSpanBits - 1 - 1);
+#endif
// If |in_empty_cache_|==1, |empty_cache_index| is undefined and mustn't be
// used.
uint16_t in_empty_cache_ : 1;
Index: chromium-120.0.6099.71/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h
===================================================================
--- chromium-120.0.6099.71.orig/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h
+++ chromium-120.0.6099.71/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h
@@ -21,6 +21,11 @@ static constexpr size_t kMaxSlotsPerSlot
// currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code,
// so we use the 16 kiB maximum (64 kiB will crash).
static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 14) / kSmallestBucket;
+#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_PPC64)
+// System page size is not a constant on OpenPOWER systems, but is either 4kiB
+// or 64kiB (1 << 12 or 1 << 16)
+// And PartitionPageSize() is 4 times the OS page size.
+static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 16) / kSmallestBucket;
#else
// A slot span can "span" multiple PartitionPages, but then its slot size is
// larger, so it doesn't have as many slots.