[webkit-changes] [WebKit/WebKit] a235f9: [libpas][PGM] Fix PGM allocation failure fallback ...
Dan Hecht
noreply at github.com
Thu Jan 23 14:41:52 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a235f958d30c86a1756884502754a8cb7c2a1efa
https://github.com/WebKit/WebKit/commit/a235f958d30c86a1756884502754a8cb7c2a1efa
Author: Dan Hecht <dan.hecht at apple.com>
Date: 2025-01-23 (Thu, 23 Jan 2025)
Changed paths:
M Source/bmalloc/libpas/src/libpas/pas_large_heap.c
M Source/bmalloc/libpas/src/libpas/pas_large_heap.h
M Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h
Log Message:
-----------
[libpas][PGM] Fix PGM allocation failure fallback path
https://bugs.webkit.org/show_bug.cgi?id=286424
rdar://143344174
Reviewed by Yusuke Suzuki.
PGM allocations are expected to fail under certain conditions.
Currently, the fallback path is taken within the "transaction"
which is not correct.
The problem occurs when:
1. The PGM allocation failed due to lock contention (try lock failed).
2. This sets the lock to be acquired in the next transaction iteration.
3. Before the transaction retry, the fallback path is taken, which might
succeed.
4. Then the transaction retry logic kicks in, resulting in:
PAS_ASSERT(!result.did_succeed);
Note that had this assert not been there, the fallback allocation would
have been leaked.
Instead, the fallback logic should occur outside of the transaction.
If the PGM allocation failed due to try lock failure, then the transaction will
acquire the lock and try again, as usual. Only if the allocation failed
due to other reasons will the new fallback allocation path be taken.
By structuring the code this way we also get the nice bonus that the
fallback allocation path is just falling through to the normal allocation
path, rather than a special case allocation from the large heap. This way,
that special and very infrequently executed case is removed.
* Source/bmalloc/libpas/src/libpas/pas_large_heap.c:
(pas_large_heap_try_allocate_pgm): Deleted.
* Source/bmalloc/libpas/src/libpas/pas_large_heap.h:
* Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h:
(pas_try_allocate_pgm):
(pas_try_allocate_common_impl_slow):
Canonical link: https://commits.webkit.org/289316@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list