mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Use free physical memory check for pbkdf only on small systems.
This hack tries to workaround situation when small VMs without swap causes OOM. This hack will be removed one day completely... Also remove confusing warning about possible crash. With OpenSSL Argon2 backend this behaves much better, but it still can cause OOM instead od returning ENOMEM. Anyway, the warning message causes more problems that it solves. Fixes: #896
This commit is contained in:
@@ -63,9 +63,11 @@ uint32_t pbkdf_adjusted_phys_memory_kb(void)
|
||||
memory_kb /= 2;
|
||||
|
||||
/*
|
||||
* Never use more that half of available free memory on system without swap.
|
||||
* On systems with < 4GB RAM without swap
|
||||
* never use more that half of available free memory.
|
||||
* This is a temporary hack to avoid OOM on small systems.
|
||||
*/
|
||||
if (!crypt_swapavailable()) {
|
||||
if (memory_kb < (2 * 1024 * 1024) && !crypt_swapavailable()) {
|
||||
free_kb = crypt_getphysmemoryfree_kb();
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user