Two reasons:
- Common answer: Many modern OS doesn't use BFQ scheduler, and deadline-related schedulers ignore ionice: check this with
cat /sys/block/sda/queue/scheduler
- In kernel, the IO on writeback pages isn't accounted to the actual process until cgroup v2 OR blkio scheduler. So, if you deleted some files which updates the dentry page cache of parent directory, the writeback page cache won't be accounted to the user and thus stay unlimited
tl;dr:
cat /sys/block/sda/queue/scheduler # Ensure it's CFQ - probably work for other scheduler. Didn't test
# Check if you are using cgroup v1 or v2:
ls /sys/fs/cgroup/ /sys/fs/cgroup2/
# If you are using cgroup v1
# '+' concates all file paths into as few "rm" calls as possible, in contrast to ';' which invokes an rm for each file
systemd-run -p "BlockIOWeight=10" --nice=19 -t find {directory} -printf "%p\n" -exec rm -f '{}' '+'
# If you are using cgroup v2
systemd-run -p "IOWeight=10" --nice=19 -t find {directory} -printf "%p\n" -exec rm -f '{}' '+'