UPSTREAM: zram: drop gfp_t from zcomp_strm_alloc()
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tue, 26 Jul 2016 22:22:59 +0000 (15:22 -0700)
committerMichael Benedict <michaelbt@live.com>
Fri, 30 Aug 2019 07:40:51 +0000 (17:40 +1000)
We now allocate streams from CPU_UP hot-plug path, there are no
context-dependent stream allocations anymore and we can schedule from
zcomp_strm_alloc().  Use GFP_KERNEL directly and drop a gfp_t parameter.

Link: http://lkml.kernel.org/r/20160531122017.2878-9-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 16d37725a042cc66f9ee95889dd40e734264508e)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: If09c4a97f3d3e45ad578d2b1d64b26f65617774d

drivers/block/zram/zcomp.c

index 32e521a2b8c8e02f6869172b8d9e4ad1ebb08618..4b5cd3a7b2b646b31a54e29eeb43661acf65e7a6 100644 (file)
@@ -47,9 +47,9 @@ static void zcomp_strm_free(struct zcomp_strm *zstrm)
  * allocate new zcomp_strm structure with ->tfm initialized by
  * backend, return NULL on error
  */
-static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp, gfp_t flags)
+static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp)
 {
-       struct zcomp_strm *zstrm = kmalloc(sizeof(*zstrm), flags);
+       struct zcomp_strm *zstrm = kmalloc(sizeof(*zstrm), GFP_KERNEL);
        if (!zstrm)
                return NULL;
 
@@ -58,7 +58,7 @@ static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp, gfp_t flags)
         * allocate 2 pages. 1 for compressed data, plus 1 extra for the
         * case when compressed size is larger than the original one
         */
-       zstrm->buffer = (void *)__get_free_pages(flags | __GFP_ZERO, 1);
+       zstrm->buffer = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
        if (IS_ERR_OR_NULL(zstrm->tfm) || !zstrm->buffer) {
                zcomp_strm_free(zstrm);
                zstrm = NULL;
@@ -169,7 +169,7 @@ static int __zcomp_cpu_notifier(struct zcomp *comp,
        case CPU_UP_PREPARE:
                if (WARN_ON(*per_cpu_ptr(comp->stream, cpu)))
                        break;
-               zstrm = zcomp_strm_alloc(comp, GFP_KERNEL);
+               zstrm = zcomp_strm_alloc(comp);
                if (IS_ERR_OR_NULL(zstrm)) {
                        pr_err("Can't allocate a compression stream\n");
                        return NOTIFY_BAD;