Try to avoid OOM killer on low-memory systems without swap.

Benchmark for memory-hard KDF is tricky, seems that relying
on maximum half of physical memory is not enough.

Let's allow only free physical available space if there is no swap.
This should not cause changes on normal systems, at least.
This commit is contained in:
Milan Broz
2023-02-20 16:45:36 +01:00
parent 62aa392205
commit 899bad8c06
4 changed files with 67 additions and 5 deletions

View File

@@ -168,6 +168,8 @@ int crypt_uuid_cmp(const char *dm_uuid, const char *hdr_uuid);
size_t crypt_getpagesize(void);
unsigned crypt_cpusonline(void);
uint64_t crypt_getphysmemory_kb(void);
uint64_t crypt_getphysmemoryfree_kb(void);
bool crypt_swapavailable(void);
int init_crypto(struct crypt_device *ctx);