Re: [PATCH 10/14] bdi: remove BDI_CAP_SYNCHRONOUS_IO
From: Christoph Hellwig
Date: Mon Jul 27 2020 - 03:58:27 EST
On Sun, Jul 26, 2020 at 12:06:39PM -0700, Minchan Kim wrote:
> > @@ -528,8 +530,7 @@ static ssize_t backing_dev_store(struct device *dev,
> > * freely but in fact, IO is going on so finally could cause
> > * use-after-free when the IO is really done.
> > */
> > - zram->disk->queue->backing_dev_info->capabilities &=
> > - ~BDI_CAP_SYNCHRONOUS_IO;
> > + zram->disk->fops = &zram_wb_devops;
> > up_write(&zram->init_lock);
> For zram, regardless of BDI_CAP_SYNCHRONOUS_IO, it have used rw_page
> every time on read/write path. This one with next patch will make zram
> use bio instead of rw_page when it's declared !BDI_CAP_SYNCHRONOUS_IO,
> which introduce regression for performance.
It really should not matter, as the overhead of setting up a bio
is minimal. It also is only used in the legacy mpage buffered I/O
code outside of the swap code, which has so many performance issues on
its own that even if this made a difference it wouldn't matter.
If you want magic treatment for your zram swap code you really need
to integrate it with the swap code instead of burding the block layer
with all this mess.