Skip to content

Commit

Permalink
Integrate PGM for large heap allocations
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=249371

Reviewed by NOBODY (OOPS!).

Enable PGM for large heap allocations.

* Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h:
(pas_try_allocate_common_impl_slow):
  • Loading branch information
stwrt committed Dec 15, 2022
1 parent 7c4ff08 commit 0b205f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Expand Up @@ -635,7 +635,7 @@
2CE2AE3327596DEB00D02BBC /* pas_segregated_deallocation_logging_mode.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CE2AE2C27596DEB00D02BBC /* pas_segregated_deallocation_logging_mode.h */; settings = {ATTRIBUTES = (Private, ); }; };
2CE2AE5D2769928300D02BBC /* pas_compact_tagged_void_ptr.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CE2AE512769928200D02BBC /* pas_compact_tagged_void_ptr.h */; settings = {ATTRIBUTES = (Private, ); }; };
2CE2AE632769928300D02BBC /* pas_probabilistic_guard_malloc_allocator.c in Sources */ = {isa = PBXBuildFile; fileRef = 2CE2AE572769928300D02BBC /* pas_probabilistic_guard_malloc_allocator.c */; };
2CE2AE642769928300D02BBC /* pas_probabilistic_guard_malloc_allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CE2AE582769928300D02BBC /* pas_probabilistic_guard_malloc_allocator.h */; };
2CE2AE642769928300D02BBC /* pas_probabilistic_guard_malloc_allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CE2AE582769928300D02BBC /* pas_probabilistic_guard_malloc_allocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
4426E2801C838EE0008EB042 /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4426E27E1C838EE0008EB042 /* Logging.cpp */; };
4426E2811C838EE0008EB042 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 4426E27F1C838EE0008EB042 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; };
52F47249210BA30200B730BB /* MemoryStatusSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 52F47248210BA2F500B730BB /* MemoryStatusSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down
10 changes: 7 additions & 3 deletions Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h
Expand Up @@ -31,7 +31,9 @@
#include "pas_allocation_result.h"
#include "pas_local_allocator_inlines.h"
#include "pas_malloc_stack_logging.h"
#include "pas_random.h"
#include "pas_primitive_heap_ref.h"
#include "pas_probabilistic_guard_malloc_allocator.h"
#include "pas_segregated_heap_inlines.h"
#include "pas_utils.h"

Expand Down Expand Up @@ -165,9 +167,11 @@ pas_try_allocate_common_impl_slow(

pas_physical_memory_transaction_begin(&transaction);
pas_heap_lock_lock();

result = pas_large_heap_try_allocate(
&heap->large_heap, size, alignment, config.config_ptr, &transaction);

if (PAS_UNLIKELY(pas_get_fast_random(100) < PAS_PGM_PROBABILITY))
result = pas_large_heap_try_allocate_pgm(&heap->large_heap, size, alignment, config.config_ptr, &transaction);
else
result = pas_large_heap_try_allocate(&heap->large_heap, size, alignment, config.config_ptr, &transaction);

pas_heap_lock_unlock();
} while (!pas_physical_memory_transaction_end(&transaction));
Expand Down

0 comments on commit 0b205f8

Please sign in to comment.