Skip to content

Commit 16d3772

Browse files
sergey-senozhatskytorvalds
authored andcommitted
zram: drop gfp_t from zcomp_strm_alloc()
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/[email protected] Signed-off-by: Sergey Senozhatsky <[email protected]> Acked-by: Minchan Kim <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent eb9f56d commit 16d3772

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/block/zram/zcomp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ static void zcomp_strm_free(struct zcomp_strm *zstrm)
4747
* allocate new zcomp_strm structure with ->tfm initialized by
4848
* backend, return NULL on error
4949
*/
50-
static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp, gfp_t flags)
50+
static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp)
5151
{
52-
struct zcomp_strm *zstrm = kmalloc(sizeof(*zstrm), flags);
52+
struct zcomp_strm *zstrm = kmalloc(sizeof(*zstrm), GFP_KERNEL);
5353
if (!zstrm)
5454
return NULL;
5555

@@ -58,7 +58,7 @@ static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp, gfp_t flags)
5858
* allocate 2 pages. 1 for compressed data, plus 1 extra for the
5959
* case when compressed size is larger than the original one
6060
*/
61-
zstrm->buffer = (void *)__get_free_pages(flags | __GFP_ZERO, 1);
61+
zstrm->buffer = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
6262
if (IS_ERR_OR_NULL(zstrm->tfm) || !zstrm->buffer) {
6363
zcomp_strm_free(zstrm);
6464
zstrm = NULL;
@@ -169,7 +169,7 @@ static int __zcomp_cpu_notifier(struct zcomp *comp,
169169
case CPU_UP_PREPARE:
170170
if (WARN_ON(*per_cpu_ptr(comp->stream, cpu)))
171171
break;
172-
zstrm = zcomp_strm_alloc(comp, GFP_KERNEL);
172+
zstrm = zcomp_strm_alloc(comp);
173173
if (IS_ERR_OR_NULL(zstrm)) {
174174
pr_err("Can't allocate a compression stream\n");
175175
return NOTIFY_BAD;

0 commit comments

Comments
 (0)