Skip to content

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Nov 14, 2025

Pull request for series with
subject: zram: introduce writeback bio batching
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1022850

@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 14, 2025

Upstream branch: 6da43bb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1022850
version: 1

@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 15, 2025

Upstream branch: 6da43bb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023790
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from a6bfffb to 92ffc73 Compare November 15, 2025 02:46
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 83d3e2f to 00d5e5c Compare November 16, 2025 07:35
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 16, 2025

Upstream branch: f824272
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023790
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 92ffc73 to 67ff285 Compare November 16, 2025 07:36
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 00d5e5c to d782508 Compare November 17, 2025 00:45
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 17, 2025

Upstream branch: f824272
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023790
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 67ff285 to 87cc234 Compare November 17, 2025 00:46
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from d782508 to 6099a4d Compare November 17, 2025 23:44
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 17, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023790
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 87cc234 to 629631a Compare November 17, 2025 23:46
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 6099a4d to 5121c4d Compare November 18, 2025 02:19
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 18, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023790
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 629631a to 2f2b7e2 Compare November 18, 2025 02:20
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 18, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024696
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 2f2b7e2 to ac79ec3 Compare November 18, 2025 07:41
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 5121c4d to 4458758 Compare November 19, 2025 00:24
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 19, 2025

Upstream branch: 8b69055
series: https://patchwork.kernel.org/project/linux-block/list/?series=1024696
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from ac79ec3 to 78ebb55 Compare November 19, 2025 00:25
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 20, 2025

Upstream branch: 8b69055
series: https://patchwork.kernel.org/project/linux-block/list/?series=1025880
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 78ebb55 to b152c00 Compare November 20, 2025 15:31
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 20, 2025

Upstream branch: 8b69055
series: https://patchwork.kernel.org/project/linux-block/list/?series=1025880
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from b152c00 to e253968 Compare November 20, 2025 16:17
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 20, 2025

Upstream branch: 8b69055
series: https://patchwork.kernel.org/project/linux-block/list/?series=1025880
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from e253968 to 55fceb5 Compare November 20, 2025 16:38
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 4458758 to 6f43942 Compare November 21, 2025 09:45
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 21, 2025

Upstream branch: fd95357
series: https://patchwork.kernel.org/project/linux-block/list/?series=1025880
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 55fceb5 to 0088743 Compare November 21, 2025 09:49
As was stated in a comment [1] a single page writeback IO
is not efficient, but it works.  It's time to address this
throughput limitation as writeback becomes used more often.
Introduce batched (multiple) bio writeback support to take
advantage of parallel requests processing and better requests
scheduling.

Approach used in this patch doesn't use a dedicated kthread
like in [2], or blk-plug like in [3].  Dedicated kthread adds
complexity, which can be avoided.  Apart from that not all
zram setups use writeback, so having numerous per-device
kthreads (on systems that create multiple zram devices)
hanging around is not the most optimal thing to do.  blk-plug,
on the other hand, works best when request are sequential,
which doesn't particularly fit zram writebck IO patterns: zram
writeback IO patterns are expected to be random, due to how
bdev block reservation/release are handled.  blk-plug approach
also works in cycles: idle IO, when zram sets up requests in
a batch, is followed by bursts of IO, when zram submits the
entire batch.

Instead we use a batch of requests and submit new bio as soon
as one of the in-flight requests completes.

For the time being the writeback batch size (maximum number of
in-flight bio requests) is set to 32 for all devices.  A follow
up patch adds a writeback_batch_size device attribute, so the
batch size becomes run-time configurable.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/

Signed-off-by: Sergey Senozhatsky <[email protected]>
Co-developed-by: Yuwen Chen <[email protected]>
Co-developed-by: Richard Chang <[email protected]>
Suggested-by: Minchan Kim <[email protected]>
Introduce writeback_batch_size device attribute so that
the maximum number of in-flight writeback bio requests
can be configured at run-time per-device.  This essentially
enables batched bio writeback.

Signed-off-by: Sergey Senozhatsky <[email protected]>
Write device attrs handlers should take write zram init_lock.
While at it, fixup coding styles.

Signed-off-by: Sergey Senozhatsky <[email protected]>
Reviewed-by: Brian Geffon <[email protected]>
We don't need wb_limit_lock.  Writeback limit setters take an
exclusive write zram init_lock, while wb_limit modifications
happen only from a single task and under zram read init_lock.
No concurrent wb_limit modifications are possible (we permit
only one post-processing task at a time).  Add lockdep
assertions to wb_limit mutators.

While at it, fixup coding styles.

Signed-off-by: Sergey Senozhatsky <[email protected]>
Reviewed-by: Brian Geffon <[email protected]>
First, writeback bdev ->bitmap bits are set only from one
context, as we can have only one single task performing
writeback, so we cannot race with anything else.  Remove
retry path.

Second, we always check ZRAM_WB flag to distinguish writtenback
slots, so we should not confuse 0 bdev block index and 0 handle.
We can use first bdev block (0 bit) for writeback as well.

While at it, give functions slightly more accurate names, as
we don't alloc/free anything there, we reserve a block for
async writeback or release the block.

Signed-off-by: Sergey Senozhatsky <[email protected]>
Reviewed-by: Brian Geffon <[email protected]>
Read slot's block id under slot-lock.  We release the
slot-lock for bdev read so, technically, slot still can
get freed in the meantime, but at least we will read
bdev block (page) that holds previous know slot data,
not from slot->handle bdev block, which can be anything
at that point.

Signed-off-by: Sergey Senozhatsky <[email protected]>
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 22, 2025

Upstream branch: fd95357
series: https://patchwork.kernel.org/project/linux-block/list/?series=1026567
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1022850=>linus-master branch from 0088743 to f907518 Compare November 22, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants