From: Yu Zhao <yuzhao@google.com>
To: Dan Streetman <ddstreet@ieee.org>, Seth Jennings <sjenning@redhat.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] zswap: only save zswap header when necessary
Date: Wed, 10 Jan 2018 15:00:30 -0800 [thread overview]
Message-ID: <20180110230030.GA110374@google.com> (raw)
In-Reply-To: <20180110224741.83751-1-yuzhao@google.com>
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@google.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.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Yu Zhao <yuzhao@google.com>
To: Dan Streetman <ddstreet@ieee.org>, Seth Jennings <sjenning@redhat.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] zswap: only save zswap header when necessary
Date: Wed, 10 Jan 2018 15:00:30 -0800 [thread overview]
Message-ID: <20180110230030.GA110374@google.com> (raw)
In-Reply-To: <20180110224741.83751-1-yuzhao@google.com>
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@google.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.
next prev parent reply other threads:[~2018-01-10 23:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-08 22:51 [PATCH] zswap: only save zswap header if zpool is shrinkable Yu Zhao
2018-01-08 22:51 ` Yu Zhao
2018-01-09 2:35 ` Sergey Senozhatsky
2018-01-09 2:35 ` Sergey Senozhatsky
2018-01-09 4:48 ` Sergey Senozhatsky
2018-01-09 4:48 ` Sergey Senozhatsky
2018-01-09 11:01 ` Yu Zhao
2018-01-09 11:01 ` Yu Zhao
2018-01-09 18:25 ` Dan Streetman
2018-01-09 18:25 ` Dan Streetman
2018-01-09 22:47 ` Yu Zhao
2018-01-09 22:47 ` Yu Zhao
2018-01-10 20:06 ` Dan Streetman
2018-01-10 20:06 ` Dan Streetman
2018-01-10 22:23 ` Yu Zhao
2018-01-10 22:23 ` Yu Zhao
2018-01-11 6:57 ` Sergey Senozhatsky
2018-01-11 6:57 ` Sergey Senozhatsky
2018-01-10 22:47 ` [PATCH v2] zswap: only save zswap header when necessary Yu Zhao
2018-01-10 22:47 ` Yu Zhao
2018-01-10 22:56 ` [PATCH v3] " Yu Zhao
2018-01-10 22:56 ` Yu Zhao
2018-01-11 7:04 ` Sergey Senozhatsky
2018-01-11 7:04 ` Sergey Senozhatsky
2018-01-11 21:59 ` Dan Streetman
2018-01-11 21:59 ` Dan Streetman
2018-01-10 23:00 ` Yu Zhao [this message]
2018-01-10 23:00 ` [PATCH v2] " Yu Zhao
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=20180110230030.GA110374@google.com \
--to=yuzhao@google.com \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sjenning@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.