From 81bbd23ad0649bfd381eaeecbd58c2c43ba08122 Mon Sep 17 00:00:00 2001 From: Wang Qing Date: Thu, 14 Sep 2017 20:51:10 +0800 Subject: [PATCH] Set kernal page size to 16K on loongson(MIPS) archtecture. This patch is specail used for mips64. --- base/allocator/partition_allocator/page_allocator.h | 7 +++++++ base/allocator/partition_allocator/partition_alloc.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/base/allocator/partition_allocator/page_allocator.h b/base/allocator/partition_allocator/page_allocator.h index f57beb7..0ef1705 100644 --- a/base/allocator/partition_allocator/page_allocator.h +++ b/base/allocator/partition_allocator/page_allocator.h @@ -17,6 +17,8 @@ namespace base { #if defined(OS_WIN) static const size_t kPageAllocationGranularityShift = 16; // 64KB +#elif __mips__ +static const size_t kPageAllocationGranularityShift = 14; // 64KB #else static const size_t kPageAllocationGranularityShift = 12; // 4KB #endif @@ -29,7 +31,12 @@ static const size_t kPageAllocationGranularityBaseMask = // All Blink-supported systems have 4096 sized system pages and can handle // permissions and commit / decommit at this granularity. +// But, on mips have 16384 sized system pages. +#ifdef __mips__ +static const size_t kSystemPageSize = 16384; +#else static const size_t kSystemPageSize = 4096; +#endif static const size_t kSystemPageOffsetMask = kSystemPageSize - 1; static const size_t kSystemPageBaseMask = ~kSystemPageOffsetMask; diff --git a/base/allocator/partition_allocator/partition_alloc.h b/base/allocator/partition_allocator/partition_alloc.h index c720a50..67c3598 100644 --- a/base/allocator/partition_allocator/partition_alloc.h +++ b/base/allocator/partition_allocator/partition_alloc.h @@ -94,7 +94,12 @@ static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2; // system page of the span. For our current max slot span size of 64k and other // constant values, we pack _all_ PartitionAllocGeneric() sizes perfectly up // against the end of a system page. +// On mips have 16KB pagesize, So kPartitionPageSize is 64KB. +#ifdef __mips__ +static const size_t kPartitionPageShift = 16; // 64KB +#else static const size_t kPartitionPageShift = 14; // 16KB +#endif static const size_t kPartitionPageSize = 1 << kPartitionPageShift; static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1; static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask;