lkml.org 
[lkml]   [2019]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [UPSTREAM KERNEL] mm/zsmalloc.c: Add module parameter malloc_force_movable
On (05/29/19 09:22), Hui Zhu wrote:
> When it enabled:
> ~# echo 1 > /sys/module/zsmalloc/parameters/malloc_force_movable
> ~# echo lz4 > /sys/module/zswap/parameters/compressor
> ~# echo zsmalloc > /sys/module/zswap/parameters/zpool
> ~# echo 1 > /sys/module/zswap/parameters/enabled
> ~# swapon /swapfile

[..]

> * We assign a page to ZS_ALMOST_EMPTY fullness group when:
> * n <= N / f, where
> @@ -1479,6 +1486,9 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp)
> if (unlikely(!size || size > ZS_MAX_ALLOC_SIZE))
> return 0;
>
> + if (zs_malloc_force_movable)
> + gfp |= __GFP_HIGHMEM | __GFP_MOVABLE;
> +
> handle = cache_alloc_handle(pool, gfp);
> if (!handle)
> return 0;

It's zsmalloc user's responsibility to pass appropriate GFP mask
to zs_malloc().

Take a loot at ZRAM, for instance,

handle = zs_malloc(zram->mem_pool, comp_len,
__GFP_KSWAPD_RECLAIM |
__GFP_NOWARN |
__GFP_HIGHMEM |
__GFP_MOVABLE);

zsmalloc should not change GFP. If zswap, for some reason,
doesn't pass __GFP_MOVABLE, then I'd suggest to patch zswap.

-ss

\
 
 \ /
  Last update: 2019-05-29 09:24    [W:0.061 / U:2.580 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site