lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180110230030.GA110374@google.com>
Date:   Wed, 10 Jan 2018 15:00:30 -0800
From:   Yu Zhao <yuzhao@...gle.com>
To:     Dan Streetman <ddstreet@...e.org>,
        Seth Jennings <sjenning@...hat.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Minchan Kim <minchan@...nel.org>,
        Nitin Gupta <ngupta@...are.org>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] zswap: only save zswap header when necessary

On Wed, Jan 10, 2018 at 02:47:41PM -0800, Yu Zhao wrote:
> We waste sizeof(swp_entry_t) for zswap header when using zsmalloc
> as zpool driver because zsmalloc doesn't support eviction.
> 
> Add zpool_evictable() to detect if zpool is potentially evictable,
> and use it in zswap to avoid waste memory for zswap header.
> 
> Signed-off-by: Yu Zhao <yuzhao@...gle.com>
> ---
>  include/linux/zpool.h |  2 ++
>  mm/zpool.c            | 26 ++++++++++++++++++++++++--
>  mm/zsmalloc.c         |  7 -------
>  mm/zswap.c            | 20 ++++++++++----------
>  4 files changed, 36 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/zpool.h b/include/linux/zpool.h
> index 004ba807df96..7238865e75b0 100644
> --- a/include/linux/zpool.h
> +++ b/include/linux/zpool.h
> @@ -108,4 +108,6 @@ void zpool_register_driver(struct zpool_driver *driver);
>  
>  int zpool_unregister_driver(struct zpool_driver *driver);
>  
> +bool zpool_evictable(struct zpool *pool);
> +
>  #endif
> diff --git a/mm/zpool.c b/mm/zpool.c
> index fd3ff719c32c..ec63ef32d73d 100644
> --- a/mm/zpool.c
> +++ b/mm/zpool.c
> @@ -21,6 +21,7 @@ struct zpool {
>  	struct zpool_driver *driver;
>  	void *pool;
>  	const struct zpool_ops *ops;
> +	bool evictable;
>  
>  	struct list_head list;
>  };
> @@ -142,7 +143,7 @@ EXPORT_SYMBOL(zpool_has_pool);
>   *
>   * This creates a new zpool of the specified type.  The gfp flags will be
>   * used when allocating memory, if the implementation supports it.  If the
> - * ops param is NULL, then the created zpool will not be shrinkable.
> + * ops param is NULL, then the created zpool will not be evictable.
>   *
>   * Implementations must guarantee this to be thread-safe.
>   *
> @@ -180,6 +181,8 @@ struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp,
>  	zpool->driver = driver;
>  	zpool->pool = driver->create(name, gfp, ops, zpool);
>  	zpool->ops = ops;
> +	zpool->evictable = zpool->driver->shrink &&
> +			   zpool->ops && zpool->ops->evict;

The zpool->" prefix is a result out copy & paste. Fixed in the next
version. Sorry for the spam.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ