Message ID | 20221128191616.1261026-6-nphamcs@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Implement writeback for zsmalloc | expand |
On Mon, Nov 28, 2022 at 11:16:14AM -0800, Nhat Pham wrote: > This adds a new field to zs_pool to store evict handlers for writeback, > analogous to the zbud allocator. > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Sergey was happy with this too: https://lore.kernel.org/linux-mm/Y3wh0i5r+9Gk2Okf@google.com/
On (22/11/28 11:16), Nhat Pham wrote: > This adds a new field to zs_pool to store evict handlers for writeback, > analogous to the zbud allocator. > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > Acked-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
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)