Re: [PATCH 0/3] mm/zram: route block swap I/O through swap_ops

From: Barry Song

Date: Mon Jun 15 2026 - 05:14:33 EST


On Sun, Jun 14, 2026 at 11:35 PM Jianyue Wu <wujianyue000@xxxxxxxxx> wrote:
>
> This series builds on Christoph Hellwig's swap batching rework that
> moves block swap onto struct swap_iocb and per-backend struct
> swap_ops handlers [1]. Christoph's patches unify batching for
> ordinary block devices and swap files. zram still needs a custom
> path because swap slots map to compressed pages, not disk sectors.
>
> The first patch adds swap_register_block_ops() so a block driver can
> install custom submit_read/submit_write handlers when swapon targets
> its block device. The default swap_bdev_ops path is unchanged for
> devices that do not register.
>
> The second patch registers zram_swap_ops at module init. On write,
> the swap core still batches folios into a swap_iocb. zram maps each
> folio to a slot index and stores it through zram_write_page() instead
> of building one bio per page. Read handling keeps slot_lock and
> mark_slot_accessed() in one critical section. Writeback-enabled zram
> falls back to swap_bdev_submit_read() for ZRAM_WB slots.
>
> The third patch moves slot_free_notify into swap_ops next to the
> other zram swap callbacks, and documents the locking contract for
> that hook.
>
> Applied on top of Christoph Hellwig's "better block swap batching and
> a different take on swap_ops" series [1].

Nice. I think it's better to mark it as RFC at this stage.

By the way, besides the architectural refinements, have
you also observed any noticeable performance improvements?

>
> [1] https://lore.kernel.org/linux-mm/?q=better+block+swap+batching

Best Regards
Barry