allocator: Ignore madvise ENOSYS error
Support kernels builts without CONFIG_ADVISE_SYSCALLS on small embedded devices.109.0.5414.74
parent
4e9b0c65e4
commit
b57c6a7ba9
|
|
@ -384,7 +384,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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue