linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Hui Zhu <teawaterz@linux.alibaba.com>
Cc: minchan@kernel.org, ngupta@vflare.org,
	sergey.senozhatsky.work@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [UPSTREAM KERNEL] mm/zsmalloc.c: Add module parameter malloc_force_movable
Date: Wed, 29 May 2019 16:24:24 +0900	[thread overview]
Message-ID: <20190529072424.GA29276@jagdpanzerIV> (raw)
In-Reply-To: <20190529012230.89042-1-teawaterz@linux.alibaba.com>

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


      reply	other threads:[~2019-05-29  7:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  1:22 Hui Zhu
2019-05-29  7:24 ` Sergey Senozhatsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190529072424.GA29276@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=teawaterz@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox