From: Seth Jennings <sjennings@variantweb.net>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Jerome Marchand <jmarchan@redhat.com>,
juno.choi@lge.com, seungho1.park@lge.com,
Luigi Semenzato <semenzato@google.com>,
Nitin Gupta <ngupta@vflare.org>,
Dan Streetman <ddstreet@ieee.org>,
ds2horner@gmail.com
Subject: Re: [PATCH v2 2/4] zsmalloc: change return value unit of zs_get_total_size_bytes
Date: Tue, 19 Aug 2014 10:11:57 -0500 [thread overview]
Message-ID: <20140819151157.GB26403@cerebellum.variantweb.net> (raw)
In-Reply-To: <20140819144628.GA26403@cerebellum.variantweb.net>
On Tue, Aug 19, 2014 at 09:46:28AM -0500, Seth Jennings wrote:
> On Tue, Aug 19, 2014 at 04:54:45PM +0900, Minchan Kim wrote:
> > zs_get_total_size_bytes returns a amount of memory zsmalloc
> > consumed with *byte unit* but zsmalloc operates *page unit*
> > rather than byte unit so let's change the API so benefit
> > we could get is that reduce unnecessary overhead
> > (ie, change page unit with byte unit) in zsmalloc.
> >
> > Now, zswap can rollback to zswap_pool_pages.
> > Over to zswap guys ;-)
>
> I don't think that's how is it done :-/ Changing the API for a
> component that has two users, changing one, then saying "hope you guys
> change your newly broken stuff".
However, I'll bite on this one :) Just squash this in so that
zpool/zswap aren't broken at any point.
Dan, care to make sure I didn't miss something?
Thanks,
Seth
diff --git a/mm/zbud.c b/mm/zbud.c
index a05790b..27a3701 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -179,7 +179,7 @@ static void zbud_zpool_unmap(void *pool, unsigned long handle)
static u64 zbud_zpool_total_size(void *pool)
{
- return zbud_get_pool_size(pool) * PAGE_SIZE;
+ return zbud_get_pool_size(pool);
}
static struct zpool_driver zbud_zpool_driver = {
diff --git a/mm/zpool.c b/mm/zpool.c
index e40612a..d126ebc 100644
--- a/mm/zpool.c
+++ b/mm/zpool.c
@@ -336,9 +336,9 @@ void zpool_unmap_handle(struct zpool *zpool, unsigned long handle)
* zpool_get_total_size() - The total size of the pool
* @pool The zpool to check
*
- * This returns the total size in bytes of the pool.
+ * This returns the total size in pages of the pool.
*
- * Returns: Total size of the zpool in bytes.
+ * Returns: Total size of the zpool in pages.
*/
u64 zpool_get_total_size(struct zpool *zpool)
{
diff --git a/mm/zswap.c b/mm/zswap.c
index ea064c1..124f750 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -45,8 +45,8 @@
/*********************************
* statistics
**********************************/
-/* Total bytes used by the compressed storage */
-static u64 zswap_pool_total_size;
+/* Total pages used by the compressed storage */
+static u64 zswap_pool_pages;
/* The number of compressed pages currently stored in zswap */
static atomic_t zswap_stored_pages = ATOMIC_INIT(0);
@@ -297,7 +297,7 @@ static void zswap_free_entry(struct zswap_entry *entry)
zpool_free(zswap_pool, entry->handle);
zswap_entry_cache_free(entry);
atomic_dec(&zswap_stored_pages);
- zswap_pool_total_size = zpool_get_total_size(zswap_pool);
+ zswap_pool_pages = zpool_get_total_size(zswap_pool);
}
/* caller must hold the tree lock */
@@ -414,7 +414,7 @@ cleanup:
static bool zswap_is_full(void)
{
return totalram_pages * zswap_max_pool_percent / 100 <
- DIV_ROUND_UP(zswap_pool_total_size, PAGE_SIZE);
+ zswap_pool_pages;
}
/*********************************
@@ -721,7 +721,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
/* update stats */
atomic_inc(&zswap_stored_pages);
- zswap_pool_total_size = zpool_get_total_size(zswap_pool);
+ zswap_pool_pages = zpool_get_total_size(zswap_pool);
return 0;
@@ -874,8 +874,8 @@ static int __init zswap_debugfs_init(void)
zswap_debugfs_root, &zswap_written_back_pages);
debugfs_create_u64("duplicate_entry", S_IRUGO,
zswap_debugfs_root, &zswap_duplicate_entry);
- debugfs_create_u64("pool_total_size", S_IRUGO,
- zswap_debugfs_root, &zswap_pool_total_size);
+ debugfs_create_u64("pool_pages", S_IRUGO,
+ zswap_debugfs_root, &zswap_pool_pages);
debugfs_create_atomic_t("stored_pages", S_IRUGO,
zswap_debugfs_root, &zswap_stored_pages);
next prev parent reply other threads:[~2014-08-19 15:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 7:54 [PATCH v2 0/4] zram memory control enhance Minchan Kim
2014-08-19 7:54 ` [PATCH v2 1/4] zsmalloc: move pages_allocated to zs_pool Minchan Kim
2014-08-19 7:54 ` [PATCH v2 2/4] zsmalloc: change return value unit of zs_get_total_size_bytes Minchan Kim
2014-08-19 14:46 ` Seth Jennings
2014-08-19 15:11 ` Seth Jennings [this message]
2014-08-19 23:47 ` Minchan Kim
2014-08-19 23:46 ` Minchan Kim
2014-08-20 4:44 ` Seth Jennings
2014-08-19 7:54 ` [PATCH v2 3/4] zram: zram memory size limitation Minchan Kim
2014-08-19 8:06 ` Marc Dietrich
2014-08-19 23:32 ` Minchan Kim
2014-08-20 7:58 ` Marc Dietrich
2014-08-19 7:54 ` [PATCH v2 4/4] zram: report maximum used memory Minchan Kim
2014-08-20 6:26 ` David Horner
2014-08-20 6:53 ` Minchan Kim
2014-08-20 7:38 ` David Horner
2014-08-20 7:53 ` Minchan Kim
2014-08-20 8:25 ` David Horner
2014-08-21 0:06 ` Minchan Kim
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=20140819151157.GB26403@cerebellum.variantweb.net \
--to=sjennings@variantweb.net \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=ds2horner@gmail.com \
--cc=jmarchan@redhat.com \
--cc=juno.choi@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=semenzato@google.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=seungho1.park@lge.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