diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62175db7ba..ff441c8e62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -404,7 +404,7 @@ jobs: - arch: aarch64_cortex-a53-static openwrt: 'target=sunxi subtarget=cortexa53' target_cpu: arm64 - extra: 'arm_cpu="cortex-a53" build_static=true' + extra: 'arm_cpu="cortex-a53" build_static=true no_madvise_syscall=true' - arch: aarch64_cortex-a72 openwrt: 'target=mvebu subtarget=cortexa72' target_cpu: arm64 @@ -443,7 +443,7 @@ jobs: - arch: arm_cortex-a7_neon-vfpv4-static openwrt: 'target=sunxi subtarget=cortexa7' target_cpu: arm - extra: 'arm_version=0 arm_cpu="cortex-a7" arm_fpu="neon-vfpv4" arm_float_abi="hard" arm_use_neon=true build_static=true' + extra: 'arm_version=0 arm_cpu="cortex-a7" arm_fpu="neon-vfpv4" arm_float_abi="hard" arm_use_neon=true build_static=true no_madvise_syscall=true' - arch: arm_cortex-a8_vfpv3 openwrt: 'target=sunxi subtarget=cortexa8' target_cpu: arm @@ -455,7 +455,7 @@ jobs: - arch: arm_cortex-a9-static openwrt: 'target=bcm53xx subtarget=generic' target_cpu: arm - extra: 'arm_version=0 arm_cpu="cortex-a9" arm_float_abi="soft" arm_use_neon=false build_static=true' + extra: 'arm_version=0 arm_cpu="cortex-a9" arm_float_abi="soft" arm_use_neon=false build_static=true no_madvise_syscall=true' - arch: arm_cortex-a9_neon openwrt: 'target=zynq subtarget=generic' target_cpu: arm @@ -479,7 +479,7 @@ jobs: - arch: mipsel_24kc-static openwrt: 'target=ramips subtarget=rt305x' target_cpu: mipsel - extra: 'mips_arch_variant="r2" mips_float_abi="soft" build_static=true' + extra: 'mips_arch_variant="r2" mips_float_abi="soft" build_static=true no_madvise_syscall=true' - arch: mipsel_mips32 openwrt: 'target=bcm47xx subtarget=generic' target_cpu: mipsel diff --git a/src/base/allocator/partition_allocator/page_allocator.h b/src/base/allocator/partition_allocator/page_allocator.h index 8e366cc168..d2fc8d28d3 100644 --- a/src/base/allocator/partition_allocator/page_allocator.h +++ b/src/base/allocator/partition_allocator/page_allocator.h @@ -260,6 +260,8 @@ constexpr PA_COMPONENT_EXPORT( PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() { #if BUILDFLAG(IS_APPLE) return false; +#elif defined(NO_MADVISE_SYSCALL) + return false; #else return true; #endif 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 d540193984..7ce657c10b 100644 --- a/src/base/allocator/partition_allocator/page_allocator_internals_posix.h +++ b/src/base/allocator/partition_allocator/page_allocator_internals_posix.h @@ -410,6 +410,9 @@ void DiscardSystemPagesInternal(uintptr_t address, size_t length) { ret = madvise(ptr, length, MADV_DONTNEED); } PA_PCHECK(ret == 0); +#elif defined(NO_MADVISE_SYSCALL) + static_cast(ptr); + static_cast(length); #else // BUILDFLAG(IS_APPLE) // We have experimented with other flags, but with suboptimal results. // @@ -417,12 +420,7 @@ void DiscardSystemPagesInternal(uintptr_t address, size_t length) { // performance benefits unclear. // // Therefore, we just do the simple thing: 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); + PA_PCHECK(0 == madvise(ptr, length, MADV_DONTNEED)); #endif // BUILDFLAG(IS_APPLE) } diff --git a/src/build/config/openwrt/BUILD.gn b/src/build/config/openwrt/BUILD.gn index 74e3104333..0ffb6a0d36 100644 --- a/src/build/config/openwrt/BUILD.gn +++ b/src/build/config/openwrt/BUILD.gn @@ -14,6 +14,8 @@ assert(current_os == "openwrt") declare_args() { build_static = false + + no_madvise_syscall = false } # This is included by reference in the //build/config/compiler config that @@ -39,6 +41,10 @@ config("compiler") { ldflags += [ "-Wl,--dynamic-linker=/lib/ld-musl-mipsel-sf.so.1" ] } + if (no_madvise_syscall) { + defines += [ "NO_MADVISE_SYSCALL" ] + } + abi = "musl" if (current_cpu == "arm") { abi = "muslgnueabi"