Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bb345ab09ac5b38035ec69ee7f96396adae11e7e
      
https://github.com/WebKit/WebKit/commit/bb345ab09ac5b38035ec69ee7f96396adae11e7e
  Author: Marcus Plutowski <[email protected]>
  Date:   2026-08-08 (Sat, 08 Aug 2026)

  Changed paths:
    M Source/WTF/wtf/FastMalloc.cpp
    M Source/WTF/wtf/SequesteredAllocator.h
    M Source/WTF/wtf/SequesteredImmortalHeap.cpp
    M Source/WTF/wtf/SequesteredImmortalHeap.h

  Log Message:
  -----------
  Drop cached SequesteredMalloc arena granules on memory-pressure notification
https://bugs.webkit.org/show_bug.cgi?id=320593
rdar://181858046

Reviewed by Keith Miller.

By default, each compiler thread caches a single granule to minimize the
latency of their next compiler job. This means the memory is never
decommitted, which adds persistent memory pressure even through
subsequent memory-pressure notifications.
This patch makes two changes:
  - Before caching a granule, each compiler thread checks whether the
    system is currently under memory pressure; if so, it doesn't cache
  - When memory pressure is encountered, we iterate all arenas and drop
    the first granule of all idle compiler threads
The latter condition requires a new lock to avoid a thread starting up
while the scavenger (or etc.) is midway through removing their granule.
This is worthwhile because the alternative would be waiting until the
compiler thread runs again, which could be some time due to the
sometimes-bursty nature of compilation jobs.

No new tests since this is an implementation detail.

* Source/WTF/wtf/FastMalloc.cpp:
(WTF::releaseFastMallocFreeMemory):
* Source/WTF/wtf/SequesteredAllocator.h:
* Source/WTF/wtf/SequesteredImmortalHeap.cpp:
(WTF::SequesteredImmortalHeap::shouldReduceRetention const):
(WTF::SequesteredImmortalHeap::scavengeImpl):
(WTF::SequesteredImmortalHeap::reclaimIdleSlots):
(WTF::SequesteredImmortalHeap::reclaimIdleGranulesOnce):
* Source/WTF/wtf/SequesteredImmortalHeap.h:

Canonical link: https://commits.webkit.org/318840@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to