]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iomap: add dirty page control to iomap_zero_iter
authorChi Zhiling <chizhiling@kylinos.cn>
Mon, 11 May 2026 09:40:07 +0000 (17:40 +0800)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 May 2026 13:35:03 +0000 (15:35 +0200)
This patch prepares the iomap framework for exFAT's upcoming migration to
iomap. During testing of the exFAT iomap branch with xfstests generic/299 on
a VM with 8GB RAM and a 40GB disk, system unresponsiveness was observed.

iomap_zero_iter() lacked dirty page throttling, which could cause memory
pressure when exFAT's valid_size mechanism triggers large-scale zeroing
operations during writes beyond valid_size.

Align iomap_zero_iter() with iomap_write_iter() by adding
balance_dirty_pages_ratelimited() to throttle dirty page generation during
large zeroing operations

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Link: https://patch.msgid.link/20260511094007.728011-1-chizhiling@163.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/buffered-io.c

index d7b648421a70fa52fe70a379990458d67647332e..437a7c527c4a447ef51456a3e1f1df502f483545 100644 (file)
@@ -1543,6 +1543,8 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero,
                size_t offset;
                bool ret;
 
+               balance_dirty_pages_ratelimited(iter->inode->i_mapping);
+
                bytes = min_t(u64, SIZE_MAX, bytes);
                status = iomap_write_begin(iter, write_ops, &folio, &offset,
                                &bytes);