|
@@ -44,6 +44,11 @@ static const char *default_compressor = "lzo";
|
|
|
|
|
|
/* Module params (documentation at end) */
|
|
|
static unsigned int num_devices = 1;
|
|
|
+/*
|
|
|
+ * Pages that compress to sizes equals or greater than this are stored
|
|
|
+ * uncompressed in memory.
|
|
|
+ */
|
|
|
+static size_t huge_class_size;
|
|
|
|
|
|
static void zram_free_page(struct zram *zram, size_t index);
|
|
|
|
|
@@ -786,6 +791,8 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ if (!huge_class_size)
|
|
|
+ huge_class_size = zs_huge_class_size(zram->mem_pool);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -965,7 +972,7 @@ compress_again:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- if (unlikely(comp_len > max_zpage_size)) {
|
|
|
+ if (unlikely(comp_len >= huge_class_size)) {
|
|
|
if (zram_wb_enabled(zram) && allow_wb) {
|
|
|
zcomp_stream_put(zram->comp);
|
|
|
ret = write_to_bdev(zram, bvec, index, bio, &element);
|