Skip to content

iomap: avoid memset iomap when iter is done#1184

Open
vfsci-bot[bot] wants to merge 1 commit intovfs.base.cifrom
pw/1081838/vfs.base.ci
Open

iomap: avoid memset iomap when iter is done#1184
vfsci-bot[bot] wants to merge 1 commit intovfs.base.cifrom
pw/1081838/vfs.base.ci

Conversation

@vfsci-bot
Copy link
Copy Markdown

@vfsci-bot vfsci-bot bot commented Apr 16, 2026

Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1081838
Submitter: Fengnan Chang
Version: 1
Patches: 1/1
Message-ID: <20260416030642.26744-1-changfengnan@bytedance.com>
Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/20260416030642.26744-1-changfengnan@bytedance.com


Automated by ml2pr

When iomap_iter() finishes its iteration (returns <= 0), it is no longer
necessary to memset the entire iomap and srcmap structures.

In high-IOPS scenarios (like 4k randread NVMe polling with io_uring),
where the majority of I/Os complete in a single extent map, this wasted
memory write bandwidth, as the caller will just discard the iterator.

Use this command to test:
taskset -c 30 ./t/io_uring -p1 -d512 -b4096 -s32 -c32 -F1 -B1 -R1 -X1
-n1 -P1 /mnt/testfile
IOPS improve about 5% on ext4 and XFS.

However, we MUST still call iomap_iter_reset_iomap() to release the
folio_batch if IOMAP_F_FOLIO_BATCH is set, otherwise we leak page
references. Therefore, split the cleanup logic: always release the
folio_batch, but skip the memset() when ret <= 0.

Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant