Commit bd0fded2 authored by Nhat Pham's avatar Nhat Pham Committed by Andrew Morton

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/20221128191616.1261026-6-nphamcs@gmail.comSigned-off-by: default avatarNhat Pham <nphamcs@gmail.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 64f768c6
...@@ -242,6 +242,8 @@ struct zs_pool { ...@@ -242,6 +242,8 @@ struct zs_pool {
#ifdef CONFIG_ZPOOL #ifdef CONFIG_ZPOOL
/* List tracking the zspages in LRU order by most recently added object */ /* List tracking the zspages in LRU order by most recently added object */
struct list_head lru; struct list_head lru;
struct zpool *zpool;
const struct zpool_ops *zpool_ops;
#endif #endif
#ifdef CONFIG_ZSMALLOC_STAT #ifdef CONFIG_ZSMALLOC_STAT
...@@ -382,7 +384,14 @@ static void *zs_zpool_create(const char *name, gfp_t gfp, ...@@ -382,7 +384,14 @@ static void *zs_zpool_create(const char *name, gfp_t gfp,
* different contexts and its caller must provide a valid * different contexts and its caller must provide a valid
* gfp mask. * 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) static void zs_zpool_destroy(void *pool)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment