Super slow subpage IO on zram block devices?
Hi,
Not sure if it's a regression or not, but on the latest 7.0-rc kernels, the discard is unacceptable slow on zram devices, if the block size is smaller than page size:
# uname -a Linux btrfs-aarch64 7.0.0-rc5-custom-64k+ #7 SMP PREEMPT_DYNAMIC Tue Mar 24 13:38:13 ACDT 2026 aarch64 GNU/Linux
# getconf PAGESIZE 65536
# zramctl NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT /dev/zram0 zstd 128M 0B 0B 0B
# time blkdiscard -p 4k /dev/zram0 [ It takes too long time that exceed my patient ]
After a reboot, if discarding using page size (64K), it finishes in seconds:
# time blkdiscard -p 64k /dev/zram0
real 0m0.024s
user 0m0.004s
sys 0m0.011s
I understand that using block size smaller than page size would cause some overhead, but seemingly eternal is beyond my expectation of "overhead".
Is this a known bug or something else?
Thanks,
Qu
Quoted 2 lines · Qu Wenruo
# time blkdiscard -p 4k /dev/zram0 [ It takes too long time that exceed my patient ]
It's not you, I bet no one has this much patience, because that's basically a "deadlock".
I'll send a patch quickly. Thanks for the report.