public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] zram: sleepable async read bio completion
@ 2026-03-04  5:15 Sergey Senozhatsky
  2026-03-04 14:43 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Senozhatsky @ 2026-03-04  5:15 UTC (permalink / raw)
  To: Jens Axboe, Christoph Hellwig
  Cc: linux-block, linux-kernel, Sergey Senozhatsky

Hello Jens, Christoph,

zram supports writeback, when "idle" pages are written back to the
actual physical device, so that they can be free from the zsmalloc
pool.  Previously, zram would write back such pages un-compressed
(raw), which made async read back rather trivial: just sibmit bio
and return.  However, decompression of every writtenback page is
expensive (battery wise), not every written back page is read back.
Therefore zram now also supports compressed writeback, which means
that async read back is not trivial anymore - zram needs to decompress
the page upon bio completion.  The problem is that bio completion is
called from atomic context, while zram decompression is sleepable.
So at this point we have to deffer the decompression to a workqueue,
which adds (painful) latency to the read path.  We clearly would like
to avoid that workquque offloading.  What can we do about it?

A wild idea, (I know it's not perfect), it would be nice if we could
decompress in the same context/task that submitted bio in the first
place.  Perhaps via addition callback:

->submit_bio()
  reads data async
->post_submit_bio()      // random name
  decompresses bio page

Is that too ugly to live?  Is there a better way to do it?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] zram: sleepable async read bio completion
  2026-03-04  5:15 [RFC] zram: sleepable async read bio completion Sergey Senozhatsky
@ 2026-03-04 14:43 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-03-04 14:43 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Jens Axboe, Christoph Hellwig, linux-block, linux-kernel

On Wed, Mar 04, 2026 at 02:15:03PM +0900, Sergey Senozhatsky wrote:
> that async read back is not trivial anymore - zram needs to decompress
> the page upon bio completion.  The problem is that bio completion is
> called from atomic context, while zram decompression is sleepable.
> So at this point we have to deffer the decompression to a workqueue,
> which adds (painful) latency to the read path.  We clearly would like
> to avoid that workquque offloading.  What can we do about it?

Nothing.  bi_end_io is called from hard/softirq context usually.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-04 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04  5:15 [RFC] zram: sleepable async read bio completion Sergey Senozhatsky
2026-03-04 14:43 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox