Running generic/551 on a tmpfs filesystem with less than 10 GB (ish)
of RAM can lead to the system running out of memory, triggering the
kernel's OOM killer and terminating the aio-dio-write-v process.
Fix generic/551 by substracting the amount of available memory allocated
for the tmpfs scratch device to the total available free memory.
Reported-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
local total_size=0
local avail_mem=`_available_memory_bytes`
+ # To avoid OOM on tmpfs, subtract the amount of available memory
+ # allocated for the tmpfs
+ [ "$FSTYP" = "tmpfs" ] && avail_mem=$((avail_mem - free_size_k * 1024))
+
# the number of AIO write operation
num_oper=$((RANDOM % 64 + 1))