diff --git a/src/base/allocator/partition_allocator/page_allocator_internals_posix.h b/src/base/allocator/partition_allocator/page_allocator_internals_posix.h index 8ae7516827..d71c6033aa 100644 --- a/src/base/allocator/partition_allocator/page_allocator_internals_posix.h +++ b/src/base/allocator/partition_allocator/page_allocator_internals_posix.h @@ -385,7 +385,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 #endif // !BUILDFLAG(IS_NACL) }