]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/551: prevent OOM when running on tmpfs with low memory
authorDaniel Gomez <da.gomez@samsung.com>
Wed, 18 Jun 2025 13:00:12 +0000 (15:00 +0200)
committerZorro Lang <zlang@kernel.org>
Fri, 20 Jun 2025 16:46:47 +0000 (00:46 +0800)
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>
tests/generic/551

index 4a7f0a638235e272ef55ffeb3b3e548707568379..267c57ecbbfbf66c577ce8faf552ef207ed45ee0 100755 (executable)
@@ -39,6 +39,10 @@ do_test()
        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))