Skip to content
Permalink
Browse files
[bmalloc] Use MADV_FREE on FreeBSD
https://bugs.webkit.org/show_bug.cgi?id=195665

Reviewed by Geoffrey Garen.

* bmalloc/BPlatform.h:

Introduce BOS_FREEBSD, which is equivalent to WTF_OS_FREEBSD

* bmalloc/VMAllocate.h:
(bmalloc::vmDeallocatePhysicalPages):

Use MADV_FREE instead of MADV_DONTNEED if BOS(FREEBSD), since on FreeBSD,
unlike on Linux, MADV_DONTNEED doesn't let the OS discard the contents of
the pages.


Canonical link: https://commits.webkit.org/210007@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
unicodon committed Mar 13, 2019
1 parent 467403b commit 53186caa3ed74bbb059e5040c627daffe739e35b
Showing 3 changed files with 24 additions and 0 deletions.
@@ -1,3 +1,21 @@
2019-03-13 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>

[bmalloc] Use MADV_FREE on FreeBSD
https://bugs.webkit.org/show_bug.cgi?id=195665

Reviewed by Geoffrey Garen.

* bmalloc/BPlatform.h:

Introduce BOS_FREEBSD, which is equivalent to WTF_OS_FREEBSD

* bmalloc/VMAllocate.h:
(bmalloc::vmDeallocatePhysicalPages):

Use MADV_FREE instead of MADV_DONTNEED if BOS(FREEBSD), since on FreeBSD,
unlike on Linux, MADV_DONTNEED doesn't let the OS discard the contents of
the pages.

2019-03-13 Sam Weinig <sam@webkit.org>

Fix testbmalloc build
@@ -48,6 +48,10 @@
#define BOS_LINUX 1
#endif

#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#define BOS_FREEBSD 1
#endif

#if defined(WIN32) || defined(_WIN32)
#define BOS_WINDOWS 1
#endif
@@ -201,6 +201,8 @@ inline void vmDeallocatePhysicalPages(void* p, size_t vmSize)
vmValidatePhysical(p, vmSize);
#if BOS(DARWIN)
SYSCALL(madvise(p, vmSize, MADV_FREE_REUSABLE));
#elif BOS(FREEBSD)
SYSCALL(madvise(p, vmSize, MADV_FREE));
#else
SYSCALL(madvise(p, vmSize, MADV_DONTNEED));
#if BOS(LINUX)

0 comments on commit 53186ca

Please sign in to comment.