[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221031054108.541190-5-senozhatsky@chromium.org>
Date: Mon, 31 Oct 2022 14:41:03 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>
Cc: Nitin Gupta <ngupta@...are.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: [PATCHv4 4/9] zsmalloc: make huge class watermark zs_pool member
We will permit per-pool configuration of pages per-zspage value,
which changes characteristics of the classes and moves around
huge class size watermark. Thus huge class size needs to be
a per-pool variable.
Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
---
mm/zsmalloc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 5f79223e7bfe..d329bd673baa 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -178,7 +178,6 @@ static struct dentry *zs_stat_root;
* (see: fix_fullness_group())
*/
static const int fullness_threshold_frac = 4;
-static size_t huge_class_size;
struct size_class {
spinlock_t lock;
@@ -227,6 +226,7 @@ struct zs_pool {
u32 num_size_classes;
u32 min_alloc_size;
+ size_t huge_class_size;
struct zs_pool_stats stats;
@@ -1350,7 +1350,7 @@ EXPORT_SYMBOL_GPL(zs_unmap_object);
*/
size_t zs_huge_class_size(struct zs_pool *pool)
{
- return huge_class_size;
+ return pool->huge_class_size;
}
EXPORT_SYMBOL_GPL(zs_huge_class_size);
@@ -2262,8 +2262,8 @@ struct zs_pool *zs_create_pool(const char *name)
* endup in the huge class.
*/
if (pages_per_zspage != 1 && objs_per_zspage != 1 &&
- !huge_class_size) {
- huge_class_size = size;
+ !pool->huge_class_size) {
+ pool->huge_class_size = size;
/*
* The object uses ZS_HANDLE_SIZE bytes to store the
* handle. We need to subtract it, because zs_malloc()
@@ -2273,7 +2273,7 @@ struct zs_pool *zs_create_pool(const char *name)
* class because it grows by ZS_HANDLE_SIZE extra bytes
* right before class lookup.
*/
- huge_class_size -= (ZS_HANDLE_SIZE - 1);
+ pool->huge_class_size -= (ZS_HANDLE_SIZE - 1);
}
/*
--
2.38.1.273.g43a17bfeac-goog
Powered by blists - more mailing lists