linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Seth Jennings <sjenning@linux.vnet.ibm.com>
To: linux-mm <linux-mm@kvack.org>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	Nitin Gupta <ngupta@vflare.org>,
	Robert Jennings <rcj@linux.vnet.ibm.com>,
	Brian King <brking@linux.vnet.ibm.com>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH] Add zv_pool_pages_count to zcache sysfs
Date: Wed, 22 Jun 2011 14:23:14 -0500	[thread overview]
Message-ID: <4E024122.5020601@linux.vnet.ibm.com> (raw)
In-Reply-To: <4E023F61.8080904@linux.vnet.ibm.com>

This attribute returns the number of pages currently
in use by the xvmalloc pool used to store persistent
pages compressed by zcache. This attribute, in combination
with the curr_pages attribute of frontswap, can be used
to calculate the effective compression of frontswap
(i.e. zv_pool_pages_count/curr_pages)

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
---
  drivers/staging/zcache/zcache.c |   20 ++++++++++++++++++++
  1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/zcache/zcache.c 
b/drivers/staging/zcache/zcache.c
index 77ac2d4..9821d88 100644
--- a/drivers/staging/zcache/zcache.c
+++ b/drivers/staging/zcache/zcache.c
@@ -684,6 +684,23 @@ static struct {
  	struct xv_pool *xvpool;
  } zcache_client;

+#ifdef CONFIG_SYSFS
+static int zv_show_pool_pages_count(char *buf)
+{
+	char *p = buf;
+	unsigned long numpages;
+
+	if (zcache_client.xvpool == NULL)
+		p += sprintf(p, "%d\n", 0);
+	else {
+		numpages = xv_get_total_size_bytes(zcache_client.xvpool);
+		p += sprintf(p, "%lu\n", numpages >> PAGE_SHIFT);
+	}
+
+	return p - buf;
+}
+#endif
+
  /*
   * Tmem operations assume the poolid implies the invoking client.
   * Zcache only has one client (the kernel itself), so translate
@@ -1130,6 +1147,8 @@ ZCACHE_SYSFS_RO_CUSTOM(zbud_unbuddied_list_counts,
  			zbud_show_unbuddied_list_counts);
  ZCACHE_SYSFS_RO_CUSTOM(zbud_cumul_chunk_counts,
  			zbud_show_cumul_chunk_counts);
+ZCACHE_SYSFS_RO_CUSTOM(zv_pool_pages_count,
+			zv_show_pool_pages_count);

  static struct attribute *zcache_attrs[] = {
  	&zcache_curr_obj_count_attr.attr,
@@ -1160,6 +1179,7 @@ static struct attribute *zcache_attrs[] = {
  	&zcache_aborted_shrink_attr.attr,
  	&zcache_zbud_unbuddied_list_counts_attr.attr,
  	&zcache_zbud_cumul_chunk_counts_attr.attr,
+	&zcache_zv_pool_pages_count_attr.attr,
  	NULL,
  };

-- 
1.7.0.4

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-06-22 19:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 19:15 frontswap/zcache: xvmalloc discussion Seth Jennings
2011-06-22 19:23 ` Seth Jennings [this message]
2011-06-23 15:38   ` [PATCH] Add zv_pool_pages_count to zcache sysfs Dave Hansen
2011-06-23 16:38 ` frontswap/zcache: xvmalloc discussion Dan Magenheimer
2011-06-23 21:59   ` Seth Jennings
2011-06-24 22:40     ` Dan Magenheimer
2011-06-30  2:31       ` Dan Magenheimer
2011-06-30 16:09         ` Dan Magenheimer
2011-06-24  6:11 ` Nitin Gupta
2011-06-24 15:52   ` Dave Hansen
2011-06-25  2:42     ` Nitin Gupta
2011-08-05 16:22   ` Seth Jennings

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=4E024122.5020601@linux.vnet.ibm.com \
    --to=sjenning@linux.vnet.ibm.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=gregkh@suse.de \
    --cc=linux-mm@kvack.org \
    --cc=ngupta@vflare.org \
    --cc=rcj@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).