]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: zpool: remove zpool_malloc_support_movable()
authorYosry Ahmed <yosry.ahmed@linux.dev>
Wed, 5 Mar 2025 06:11:33 +0000 (06:11 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 17 Mar 2025 07:05:41 +0000 (00:05 -0700)
zpool_malloc_support_movable() always returns true for zsmalloc, the only
remaining zpool driver.  Remove it and set the gfp flags in
zswap_compress() accordingly.  Opportunistically use GFP_NOWAIT instead of
__GFP_NOWARN | __GFP_KSWAPD_RECLAIM for conciseness as they are
equivalent.

Link: https://lkml.kernel.org/r/20250305061134.4105762-6-yosry.ahmed@linux.dev
Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/zpool.h
mm/zpool.c
mm/zsmalloc.c
mm/zswap.c

index 2c8a9d2654f6f089e7fd2c6e2b6cc599eb9a1e1b..52f30e526607fb495e1dc3269beb3446389c7525 100644 (file)
@@ -21,8 +21,6 @@ const char *zpool_get_type(struct zpool *pool);
 
 void zpool_destroy_pool(struct zpool *pool);
 
-bool zpool_malloc_support_movable(struct zpool *pool);
-
 int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
                        unsigned long *handle);
 
@@ -65,7 +63,6 @@ struct zpool_driver {
        void *(*create)(const char *name, gfp_t gfp);
        void (*destroy)(void *pool);
 
-       bool malloc_support_movable;
        int (*malloc)(void *pool, size_t size, gfp_t gfp,
                                unsigned long *handle);
        void (*free)(void *pool, unsigned long handle);
index 4fc665b42f5e928a5e5fe605e26f37523c0183cc..6d6d8893093247a687eb6575215f926977e8790f 100644 (file)
@@ -220,22 +220,6 @@ const char *zpool_get_type(struct zpool *zpool)
        return zpool->driver->type;
 }
 
-/**
- * zpool_malloc_support_movable() - Check if the zpool supports
- *     allocating movable memory
- * @zpool:     The zpool to check
- *
- * This returns if the zpool supports allocating movable memory.
- *
- * Implementations must guarantee this to be thread-safe.
- *
- * Returns: true if the zpool supports allocating movable memory, false if not
- */
-bool zpool_malloc_support_movable(struct zpool *zpool)
-{
-       return zpool->driver->malloc_support_movable;
-}
-
 /**
  * zpool_malloc() - Allocate memory
  * @zpool:     The zpool to allocate from.
index cd1c2a8ffef0572b13e704125bbd0b81c7f03757..961b270f023c238b04ce3f804711f0e0bdae1394 100644 (file)
@@ -503,7 +503,6 @@ static struct zpool_driver zs_zpool_driver = {
        .owner =                  THIS_MODULE,
        .create =                 zs_zpool_create,
        .destroy =                zs_zpool_destroy,
-       .malloc_support_movable = true,
        .malloc =                 zs_zpool_malloc,
        .free =                   zs_zpool_free,
        .obj_read_begin =         zs_zpool_obj_read_begin,
index 7de54f105d04db7ba181569452ded1ee9432f5e8..5f0e62289444c92c734ea4942dd9c9d48d8bd203 100644 (file)
@@ -964,9 +964,7 @@ static bool zswap_compress(struct page *page, struct zswap_entry *entry,
                goto unlock;
 
        zpool = pool->zpool;
-       gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM;
-       if (zpool_malloc_support_movable(zpool))
-               gfp |= __GFP_HIGHMEM | __GFP_MOVABLE;
+       gfp = GFP_NOWAIT | __GFP_NORETRY | __GFP_HIGHMEM | __GFP_MOVABLE;
        alloc_ret = zpool_malloc(zpool, dlen, gfp, &handle);
        if (alloc_ret)
                goto unlock;