Compare commits

..

3 Commits

Author SHA1 Message Date
klzgrad
5edebbfffb allocator: Ignore madvise ENOSYS error
Support kernels builts without CONFIG_ADVISE_SYSCALLS on small
embedded devices.
2022-11-12 15:13:24 +08:00
klzgrad
f9f98eedd9 Revert "Disable PartitionAlloc for old device builds"
This reverts commit 15fe90088c.
2022-11-12 15:13:17 +08:00
klzgrad
15fe90088c Disable PartitionAlloc for old device builds 2022-11-12 14:29:20 +08:00

View File

@ -361,7 +361,12 @@ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
// performance benefits unclear.
//
// Therefore, we just do the simple thing: MADV_DONTNEED.
PA_PCHECK(0 == madvise(ptr, length, MADV_DONTNEED));
int ret = madvise(ptr, length, MADV_DONTNEED);
if (ret && errno == ENOSYS) {
// Ignores when the kernel is built without CONFIG_ADVISE_SYSCALLS
return;
}
PA_PCHECK(ret == 0);
#endif
}