⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 279922 in webkit


Ignore:
Timestamp:
Jul 14, 2021, 2:18:22 PM (5 years ago)
Author:
msaboff@apple.com
Message:

[BMalloc] Lazily allocate physical pages
https://bugs.webkit.org/show_bug.cgi?id=227957

Reviewed by Mark Lam.

For the Darwin platform we don't need to call madvise(..., MADV_FREE_REUSE) to commit physical
memory to back a range of allocated virtual memory. Instead the kernel will commit pages
as they are touched. This can reduce the footprint of a process when there is sparse access
of allocated memory.

Also fixed a minor bug where we allocate memory, but don't update the amount of physical memory
associated with it.

  • bmalloc/Heap.cpp:

(bmalloc::Heap::tryAllocateLargeChunk):

  • bmalloc/VMAllocate.h:

(bmalloc::vmAllocatePhysicalPages):

Location:
trunk/Source/bmalloc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r279867 r279922  
     12021-07-14  Michael Saboff  <msaboff@apple.com>
     2
     3        [BMalloc] Lazily allocate physical pages
     4        https://bugs.webkit.org/show_bug.cgi?id=227957
     5
     6        Reviewed by Mark Lam.
     7
     8        For the Darwin platform we don't need to call madvise(..., MADV_FREE_REUSE) to commit physical
     9        memory to back a range of allocated virtual memory.  Instead the kernel will commit pages
     10        as they are touched.  This can reduce the footprint of a process when there is sparse access
     11        of allocated memory.
     12
     13        Also fixed a minor bug where we allocate memory, but don't update the amount of physical memory
     14        associated with it.
     15
     16        * bmalloc/Heap.cpp:
     17        (bmalloc::Heap::tryAllocateLargeChunk):
     18        * bmalloc/VMAllocate.h:
     19        (bmalloc::vmAllocatePhysicalPages):
     20
    1212021-07-12  Filip Pizlo  <fpizlo@apple.com> and Yusuke Suzuki  <ysuzuki@apple.com>
    222
  • trunk/Source/bmalloc/bmalloc/Heap.cpp

    r279867 r279922  
    587587#endif
    588588
    589     return LargeRange(memory, size, 0, 0, memory);
     589    return LargeRange(memory, size, size, size, static_cast<char*>(memory) + size);
    590590}
    591591
  • trunk/Source/bmalloc/bmalloc/VMAllocate.h

    r263371 r279922  
    216216    vmValidatePhysical(p, vmSize);
    217217#if BOS(DARWIN)
    218     SYSCALL(madvise(p, vmSize, MADV_FREE_REUSE));
     218    BUNUSED_PARAM(p);
     219    BUNUSED_PARAM(vmSize);
     220    // For the Darwin platform, we don't need to call madvise(..., MADV_FREE_REUSE)
     221    // to commit physical memory to back a range of allocated virtual memory.
     222    // Instead the kernel will commit pages as they are touched.
    219223#else
    220224    SYSCALL(madvise(p, vmSize, MADV_NORMAL));
Note: See TracChangeset for help on using the changeset viewer.