diff options
author | Ivan A. Melnikov <iv@altlinux.org> | 2021-04-09 11:45:10 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2021-04-11 19:50:41 +0300 |
commit | fc3d3a7296ef58bb799a73943636b8bfd95339f7 (patch) | |
tree | 49539b3d03ac9ac89d25314e38724293998a4f9b /src | |
parent | CMake: Use interface library for better FindLibLZMA compatibility. (diff) | |
download | xz-fc3d3a7296ef58bb799a73943636b8bfd95339f7.tar.xz |
Reduce maximum possible memory limit on MIPS32
Due to architectural limitations, address space available to a single
userspace process on MIPS32 is limited to 2 GiB, not 4, even on systems
that have more physical RAM -- e.g. 64-bit systems with 32-bit
userspace, or systems that use XPA (an extension similar to x86's PAE).
So, for MIPS32, we have to impose stronger memory limits. I've chosen
2000MiB to give the process some headroom.
Diffstat (limited to 'src')
-rw-r--r-- | src/xz/hardware.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xz/hardware.c b/src/xz/hardware.c index 7cb33582..0ad8c658 100644 --- a/src/xz/hardware.c +++ b/src/xz/hardware.c @@ -91,7 +91,13 @@ hardware_memlimit_set(uint64_t new_memlimit, // Use a value less than SIZE_MAX so that there's some room // for the xz program and so on. Don't use 4000 MiB because // it could look like someone mixed up base-2 and base-10. +#ifdef __mips__ + // For MIPS32, due to architectural pecularities, + // the limit is even lower. + const uint64_t limit_max = UINT64_C(2000) << 20; +#else const uint64_t limit_max = UINT64_C(4020) << 20; +#endif // UINT64_MAX is a special case for the string "max" so // that has to be handled specially. |