aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNhat Pham <[email protected]>2022-11-28 11:16:14 -0800
committerAndrew Morton <[email protected]>2022-12-11 18:12:10 -0800
commitbd0fded29689a762e6a749a1258a59cc2b99a18a (patch)
tree405e8bea73a1b50ee0f062da474bf45045ce13cc
parent64f768c6b32e1957e2b65b70e97cb4cb62344bc4 (diff)
zsmalloc: add zpool_ops field to zs_pool to store evict handlers
This adds a new field to zs_pool to store evict handlers for writeback, analogous to the zbud allocator. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Nhat Pham <[email protected]> Acked-by: Minchan Kim <[email protected]> Acked-by: Johannes Weiner <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Cc: Dan Streetman <[email protected]> Cc: Nitin Gupta <[email protected]> Cc: Seth Jennings <[email protected]> Cc: Vitaly Wool <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--mm/zsmalloc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index b1bc231d94a3..d06f9150b9da 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -242,6 +242,8 @@ struct zs_pool {
#ifdef CONFIG_ZPOOL
/* List tracking the zspages in LRU order by most recently added object */
struct list_head lru;
+ struct zpool *zpool;
+ const struct zpool_ops *zpool_ops;
#endif
#ifdef CONFIG_ZSMALLOC_STAT
@@ -382,7 +384,14 @@ static void *zs_zpool_create(const char *name, gfp_t gfp,
* different contexts and its caller must provide a valid
* gfp mask.
*/
- return zs_create_pool(name);
+ struct zs_pool *pool = zs_create_pool(name);
+
+ if (pool) {
+ pool->zpool = zpool;
+ pool->zpool_ops = zpool_ops;
+ }
+
+ return pool;
}
static void zs_zpool_destroy(void *pool)