Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call
@ 2026-11-09 19:33 Petr Vorel
  2026-11-09 19:38 ` Petr Vorel
  2026-11-10  9:47 ` Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2026-11-09 19:33 UTC (permalink / raw)
  To: ltp

zram_fill_fs() spawned a new dd process for every 1 KiB written. Filling
the 384 MiB Btrfs device alone takes up to ~390k process spawns, the four
smaller devices before it already needed 284k-350k. On slow process
creation (e.g. Xen PV dom0) the test then runs for hours: openQA jobs on
SLE12-SP5 and SLE15-SP6 were killed after 2h15m while still filling zram4
(Btrfs), with no kernel errors in the console log.

Write the whole file with a single dd using the same 1 KiB block size
until it fails with ENOSPC and take the written size from the file size.
The device is filled to the same level, the reported size and the
compression ratio calculation are unchanged.

This speedups the 7th test run rapidly, which avoids the timeout on
Btrfs.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hopefully this does not spoil the testcase itself by being too easy.

 testcases/kernel/device-drivers/zram/zram01.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
index 4b7f2a753f..f6dfb6f8aa 100755
--- a/testcases/kernel/device-drivers/zram/zram01.sh
+++ b/testcases/kernel/device-drivers/zram/zram01.sh
@@ -135,13 +135,11 @@ zram_fill_fs()
 
 	for i in $(seq $dev_start $dev_end); do
 		tst_res TINFO "filling zram$i (it can take long time)"
+		# dd is expected to fail with ENOSPC once the device is full
+		dd if=/dev/zero of="zram$i/file" bs=1024 status=none \
+			>/dev/null 2>err.txt
 		b=0
-		while true; do
-			dd conv=notrunc if=/dev/zero of=zram${i}/file \
-				oflag=append count=1 bs=1024 status=none \
-				>/dev/null 2>err.txt || break
-			b=$(($b + 1))
-		done
+		[ -f "zram$i/file" ] && b=$(($(wc -c < "zram$i/file") / 1024))
 		if [ $b -eq 0 ]; then
 			[ -s err.txt ] && tst_res TWARN "dd error: $(cat err.txt)"
 			tst_brk TBROK "cannot fill zram $i"
-- 
2.56.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call
  2026-11-09 19:33 [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call Petr Vorel
@ 2026-11-09 19:38 ` Petr Vorel
  2026-11-10  9:47 ` Cyril Hrubis
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2026-11-09 19:38 UTC (permalink / raw)
  To: ltp

Hi,

More data how it's slow on the current implementation (without this patch):

We have these filesystems:
zram01 6 TINFO: mount /dev/zram0 (ext2)
zram01 6 TINFO: mount /dev/zram1 (ext3)
zram01 6 TINFO: mount /dev/zram2 (ext4)
zram01 6 TINFO: mount /dev/zram3 (xfs)
zram01 6 TINFO: mount /dev/zram4 (btrfs)
zram01 6 TINFO: mount /dev/zram5 (vfat)

For some reason only for XFS and Btrfs test use bigger disk size and therefore
bigger memory limit (I haven't investigated, but we use the same lzo alg. for
all of them):

zram01 3 TINFO: set disk size to zram device(s)
zram01 3 TINFO: /sys/block/zram0/disksize = '26214400'
zram01 3 TINFO: /sys/block/zram1/disksize = '26214400'
zram01 3 TINFO: /sys/block/zram2/disksize = '26214400'
zram01 3 TINFO: /sys/block/zram3/disksize = '314572800'
zram01 3 TINFO: /sys/block/zram4/disksize = '402653184'
zram01 3 TINFO: /sys/block/zram5/disksize = '26214400'
zram01 3 TPASS: test succeeded
zram01 4 TINFO: set memory limit to zram device(s)
zram01 4 TINFO: /sys/block/zram0/mem_limit = '25M'
zram01 4 TINFO: /sys/block/zram1/mem_limit = '25M'
zram01 4 TINFO: /sys/block/zram2/mem_limit = '25M'
zram01 4 TINFO: /sys/block/zram3/mem_limit = '300M'
zram01 4 TINFO: /sys/block/zram4/mem_limit = '384M'
zram01 4 TINFO: /sys/block/zram5/mem_limit = '25M'

And therefore filling it (test 7) fails on Btrfs:
zram01 7 TINFO: filling zram0 (it can take long time)
zram01 7 TPASS: zram0 was filled with '24724' KB
zram01 7 TINFO: /sys/block/zram0/mm_stat
24145920    24006    69632 26214400    69632     5877        0
zram01 7 TINFO: mem_used_total: 69632
zram01 7 TPASS: compression ratio: 363.58:1
zram01 7 TINFO: filling zram1 (it can take long time)
zram01 7 TPASS: zram1 was filled with '20628' KB
zram01 7 TINFO: /sys/block/zram1/mm_stat
26144768   184936   577536 26214400   577536     6079        0
zram01 7 TINFO: mem_used_total: 577536
zram01 7 TPASS: compression ratio: 36.57:1
zram01 7 TINFO: filling zram2 (it can take long time)
zram01 7 TPASS: zram2 was filled with '20132' KB
zram01 7 TINFO: /sys/block/zram2/mm_stat
24580096    31639   122880 26214400   122880     5774        0
zram01 7 TINFO: mem_used_total: 122880
zram01 7 TPASS: compression ratio: 167.76:1
zram01 7 TINFO: filling zram3 (it can take long time)
zram01 7 TPASS: zram3 was filled with '285128' KB
zram01 7 TINFO: /sys/block/zram3/mm_stat
298844160   100509   249856 314572800   253952    72411        0
zram01 7 TINFO: mem_used_total: 249856
zram01 7 TPASS: compression ratio: 1168.55:1
zram01 7 TINFO: filling zram4 (it can take long time)

Interesting enough, ~1/4 smaller XFS is ok, Btrfs is probably too big.
Of course nothing problematic in dmesg, IMHO it's just long (2h15m while still
filling zram4 btrfs).

And yes, looking into logs suggest testing each filesystem separately would help
to read the logs.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call
  2026-11-09 19:33 [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call Petr Vorel
  2026-11-09 19:38 ` Petr Vorel
@ 2026-11-10  9:47 ` Cyril Hrubis
  2026-11-10 11:18   ` Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2026-11-10  9:47 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

Good catch!

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call
  2026-11-10  9:47 ` Cyril Hrubis
@ 2026-11-10 11:18   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2026-11-10 11:18 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

thanks for your review, merged!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-10 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 19:33 [LTP] [PATCH 1/1] zram01.sh: Fill the filesystem with a single dd call Petr Vorel
2026-11-09 19:38 ` Petr Vorel
2026-11-10  9:47 ` Cyril Hrubis
2026-11-10 11:18   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox