Linux-Block Archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] zram: further limit recompression threshold
@ 2023-06-15  1:30 Sergey Senozhatsky
  0 siblings, 0 replies; only message in thread
From: Sergey Senozhatsky @ 2023-06-15  1:30 UTC (permalink / raw
  To: Andrew Morton, Minchan Kim
  Cc: Jens Axboe, linux-kernel, linux-block, Sergey Senozhatsky,
	Brian Geffon

Recompression threshold should be below huge-size-class watermark.
Any object larger than huge-size-class is a "huge object" and
occupies a whole physical page on the zsmalloc side, in other
words it's incompressible, as far as zsmalloc is concerned.

Suggested-by: Brian Geffon <bgeffon@google.com>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-15  1:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15  1:30 [PATCHv2] zram: further limit recompression threshold Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).