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/SOURCES/use-sysconf-page-size-on-pp...

67 lines
3.4 KiB

4 months ago
Index: chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
===================================================================
--- chromium-127.0.6533.72.orig/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
+++ chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
@@ -176,7 +176,11 @@ SystemPageBaseMask() {
return ~SystemPageOffsetMask();
}
4 months ago
+#if PA_BUILDFLAG(PA_ARCH_CPU_PPC64_FAMILY)
+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 internal
4 months ago
Index: chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page.h
===================================================================
--- chromium-127.0.6533.72.orig/base/allocator/partition_allocator/src/partition_alloc/partition_page.h
+++ chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page.h
@@ -87,7 +87,11 @@ struct SlotSpanMetadata {
// CHECK()ed in AllocNewSlotSpan().
// The maximum number of bits needed to cover all currently supported OSes.
4 months ago
+#if PA_BUILDFLAG(PA_ARCH_CPU_PPC64_FAMILY)
+ 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
4 months ago
@@ -101,7 +105,11 @@ struct SlotSpanMetadata {
private:
const uint32_t can_store_raw_size_ : 1;
uint32_t freelist_is_sorted_ : 1;
4 months ago
+#if PA_BUILDFLAG(PA_ARCH_CPU_PPC64_FAMILY)
+ 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;
4 months ago
Index: chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h
===================================================================
--- chromium-127.0.6533.72.orig/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h
+++ chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h
// PartitionPageSize() is 4 times the OS page size.
static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 14) / kSmallestBucket;
#elif defined(PARTITION_ALLOCATOR_CONSTANTS_POSIX_NONCONST_PAGE_SIZE)
+#if PA_BUILDFLAG(PA_ARCH_CPU_ARM64)
4 months ago
// System page size can be 4, 16, or 64 kiB on Linux on arm64. 64 kiB is
// 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;
#else
+// System page size can range from 4 to 64 kiB on Linux on other architectures.
+// 64kiB kiB is currently used by most ppc64 distributions, so use that as the
+// maximum.
+static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 16) / kSmallestBucket;
+#endif
+#else
// A slot span can "span" multiple PartitionPages, but then its slot size is
// larger, so it doesn't have as many slots.
static constexpr size_t kMaxSlotsPerSlotSpan =