Re: [PATCH] zram: Allow backing device to be assigned after init

From: Brian Geffon
Date: Mon Oct 04 2021 - 10:35:23 EST


On Fri, Oct 1, 2021 at 7:22 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 1 Oct 2021 11:16:27 -0700 Brian Geffon <bgeffon@xxxxxxxxxx> wrote:
>
> > There does not appear to be a technical reason to not
> > allow the zram backing device to be assigned after the
> > zram device is initialized.
> >
> > This change will allow for the backing device to be assigned
> > as long as no backing device is already assigned. In that
> > event backing_dev would return -EEXIST.
>
> Why is this useful?

Hi Andrew,
In the case of ChromeOS we're backing zram with a loop device. For us,
having the ability to size the backing file after the system has fully
booted proves to be very useful. Also, doing so later allows us to
place users in different experimental groups while we evaluate the
performance of swapping to disk in the wild. Both of these things
would be much harder if we did it early on when swap is first brought
up or would require us to delay starting swap altogether.

Brian