1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

Kernel: Start implementing purgeable memory support

It's now possible to get purgeable memory by using mmap(MAP_PURGEABLE).
Purgeable memory has a "volatile" flag that can be set using madvise():

- madvise(..., MADV_SET_VOLATILE)
- madvise(..., MADV_SET_NONVOLATILE)

When in the "volatile" state, the kernel may take away the underlying
physical memory pages at any time, without notifying the owner.
This gives you a guilt discount when caching very large things. :^)

Setting a purgeable region to non-volatile will return whether or not
the memory has been taken away by the kernel while being volatile.
Basically, if madvise(..., MADV_SET_NONVOLATILE) returns 1, that means
the memory was purged while volatile, and whatever was in that piece
of memory needs to be reconstructed before use.
This commit is contained in:
Andreas Kling 2019-12-09 19:12:38 +01:00
parent 7248c34e35
commit dbb644f20c
13 changed files with 196 additions and 9 deletions

View file

@ -144,7 +144,9 @@ typedef u32 socklen_t;
__ENUMERATE_SYSCALL(module_unload) \
__ENUMERATE_SYSCALL(detach_thread) \
__ENUMERATE_SYSCALL(set_thread_name) \
__ENUMERATE_SYSCALL(get_thread_name)
__ENUMERATE_SYSCALL(get_thread_name) \
__ENUMERATE_SYSCALL(madvise) \
__ENUMERATE_SYSCALL(purge)
namespace Syscall {