When clearing pages purge()
drops dirty pages for inode VM objects because we're not tracking whether a page was dirtied. This can be observed by calling purge -c
when the following test program is running:
#include <LibMain/Main.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
ErrorOr<int> serenity_main(Main::Arguments)
{
int fd = open("/etc/fstab", O_RDONLY);
char* p = (char*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_FILE | MAP_PRIVATE, fd, 0);
close(fd);
uintptr_t zero { 0 };
memcpy(p, &zero, sizeof(zero));
for (;;) {
sleep(1);
VERIFY(memcmp(p, &zero, sizeof(zero)) == 0);
}
return 0;
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too