2023-06-14 14:46:14

by Sergey Senozhatsky

[permalink] [raw]
Subject: [PATCH] zram: further limit recompression threshold

Recompression threshold should be below huge-size-class
watermark.

Suggested-by: Brian Geffon <[email protected]>
Signed-off-by: Sergey Senozhatsky <[email protected]>
---
drivers/block/zram/zram_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1867f378b319..5676e6dd5b16 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1753,7 +1753,7 @@ static ssize_t recompress_store(struct device *dev,
}
}

- if (threshold >= PAGE_SIZE)
+ if (threshold >= huge_class_size)
return -EINVAL;

down_read(&zram->init_lock);
--
2.41.0.162.gfafddb0af9-goog



2023-06-14 20:20:33

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] zram: further limit recompression threshold

On Wed, 14 Jun 2023 23:13:12 +0900 Sergey Senozhatsky <[email protected]> wrote:

> Recompression threshold should be below huge-size-class
> watermark.

The changelog explains what the code does, but not why it does it?

> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1753,7 +1753,7 @@ static ssize_t recompress_store(struct device *dev,
> }
> }
>
> - if (threshold >= PAGE_SIZE)
> + if (threshold >= huge_class_size)
> return -EINVAL;
>
> down_read(&zram->init_lock);
> --
> 2.41.0.162.gfafddb0af9-goog

2023-06-15 01:41:35

by Sergey Senozhatsky

[permalink] [raw]
Subject: Re: [PATCH] zram: further limit recompression threshold

On (23/06/14 12:52), Andrew Morton wrote:
> On Wed, 14 Jun 2023 23:13:12 +0900 Sergey Senozhatsky <[email protected]> wrote:
>
> > Recompression threshold should be below huge-size-class
> > watermark.
>
> The changelog explains what the code does, but not why it does it?

Good point. Let me send out a V2 quickly.