linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Various cleanups/fixes to zcache (v3).
@ 2013-02-14  3:04 Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 01/16] zcache: s/int/bool/ on the various options Konrad Rzeszutek Wilk
                   ` (15 more replies)
  0 siblings, 16 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh; +Cc: sjenning, rcj

>From Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> # This line is ignored.
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH] Various cleanups/fixes to zcache (v3).
In-Reply-To: 

Hey Greg,

These patches do various cleanups of the zcache driver. The majority of the
work is just to move all the different counters out to a debug file. The next
step would be to figure out which ones are actually pertient and which can
go under the knife. Oh, and also fix some of the compiler warnings.

This is based on top of ommit 76426daf50d5df38893cc189e9ccd026093debc8
("staging/zcache: Fix/improve zcache writeback code, tie to a config option")
so should apply cleanly to your tree.

Please apply.

These patches are also available on this git tree:

git://git.kernel.org/pub/scm/linux/kernel/git/konrad/mm.git devel/zcache.cleanup.v2.5

if you would prefer to pull them.


 drivers/staging/zcache/Kconfig           |   8 +
 drivers/staging/zcache/Makefile          |   1 +
 drivers/staging/zcache/debug.c           |  71 ++++++
 drivers/staging/zcache/debug.h           | 229 ++++++++++++++++++
 drivers/staging/zcache/ramster/ramster.c |  34 +--
 drivers/staging/zcache/zbud.c            | 130 ++++++----
 drivers/staging/zcache/zcache-main.c     | 401 ++++++++-----------------------
 7 files changed, 501 insertions(+), 373 deletions(-)


Konrad Rzeszutek Wilk (16):
      zcache: s/int/bool/ on the various options.
      zcache: Provide accessory functions for counter increase
      zcache: Provide accessory functions for counter decrease.
      zcache: The last of the atomic reads has now an accessory function.
      zcache: Fix compile warnings due to usage of debugfs_create_size_t
      zcache: Make the debug code use pr_debug
      zcache: Move debugfs code out of zcache-main.c file.
      zcache/debug: Use an array to initialize/use debugfs attributes.
      zcache: Move the last of the debugfs counters out
      zcache: Module license is defined twice.
      zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG
      zcache/zbud: Fix compiler warnings.
      zcache/zbud: Add incremental accessory counters
      zcache/zbud: Provide the accessory functions for counter decrease.
      ramster: Fix compile warnings due to usage of debugfs_create_size_t
      zcache/zbud: Fix __init mismatch


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/16] zcache: s/int/bool/ on the various options.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 02/16] zcache: Provide accessory functions for counter increase Konrad Rzeszutek Wilk
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

There are so many, but this allows us to at least have them
right in as bool.

[v1: Rebase on ramster->zcache move]
[v2: Rebase on staging/zcache: Fix/improve zcache writeback code, tie to a config option]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 4456ab4..5daa0be 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -34,9 +34,9 @@
 #include "zbud.h"
 #include "ramster.h"
 #ifdef CONFIG_RAMSTER
-static int ramster_enabled;
+static bool ramster_enabled __read_mostly;
 #else
-#define ramster_enabled 0
+#define ramster_enabled false
 #endif
 
 #ifndef __PG_WAS_ACTIVE
@@ -62,11 +62,11 @@ static inline void frontswap_tmem_exclusive_gets(bool b)
 /* enable (or fix code) when Seth's patches are accepted upstream */
 #define zcache_writeback_enabled 0
 
-static int zcache_enabled __read_mostly;
-static int disable_cleancache __read_mostly;
-static int disable_frontswap __read_mostly;
-static int disable_frontswap_ignore_nonactive __read_mostly;
-static int disable_cleancache_ignore_nonactive __read_mostly;
+static bool zcache_enabled __read_mostly;
+static bool disable_cleancache __read_mostly;
+static bool disable_frontswap __read_mostly;
+static bool disable_frontswap_ignore_nonactive __read_mostly;
+static bool disable_cleancache_ignore_nonactive __read_mostly;
 static char *namestr __read_mostly = "zcache";
 
 #define ZCACHE_GFP_MASK \
@@ -1840,16 +1840,16 @@ struct frontswap_ops zcache_frontswap_register_ops(void)
 
 static int __init enable_zcache(char *s)
 {
-	zcache_enabled = 1;
+	zcache_enabled = true;
 	return 1;
 }
 __setup("zcache", enable_zcache);
 
 static int __init enable_ramster(char *s)
 {
-	zcache_enabled = 1;
+	zcache_enabled = true;
 #ifdef CONFIG_RAMSTER
-	ramster_enabled = 1;
+	ramster_enabled = true;
 #endif
 	return 1;
 }
@@ -1859,7 +1859,7 @@ __setup("ramster", enable_ramster);
 
 static int __init no_cleancache(char *s)
 {
-	disable_cleancache = 1;
+	disable_cleancache = true;
 	return 1;
 }
 
@@ -1867,7 +1867,7 @@ __setup("nocleancache", no_cleancache);
 
 static int __init no_frontswap(char *s)
 {
-	disable_frontswap = 1;
+	disable_frontswap = true;
 	return 1;
 }
 
@@ -1883,7 +1883,7 @@ __setup("nofrontswapexclusivegets", no_frontswap_exclusive_gets);
 
 static int __init no_frontswap_ignore_nonactive(char *s)
 {
-	disable_frontswap_ignore_nonactive = 1;
+	disable_frontswap_ignore_nonactive = true;
 	return 1;
 }
 
@@ -1891,7 +1891,7 @@ __setup("nofrontswapignorenonactive", no_frontswap_ignore_nonactive);
 
 static int __init no_cleancache_ignore_nonactive(char *s)
 {
-	disable_cleancache_ignore_nonactive = 1;
+	disable_cleancache_ignore_nonactive = true;
 	return 1;
 }
 
@@ -1900,7 +1900,7 @@ __setup("nocleancacheignorenonactive", no_cleancache_ignore_nonactive);
 static int __init enable_zcache_compressor(char *s)
 {
 	strncpy(zcache_comp_name, s, ZCACHE_COMP_NAME_SZ);
-	zcache_enabled = 1;
+	zcache_enabled = true;
 	return 1;
 }
 __setup("zcache=", enable_zcache_compressor);
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/16] zcache: Provide accessory functions for counter increase
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 01/16] zcache: s/int/bool/ on the various options Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 03/16] zcache: Provide accessory functions for counter decrease Konrad Rzeszutek Wilk
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

This is the first step in moving the debugfs code out of the
main file in-to another file. And also allow the code to run
without CONFIG_DEBUG_FS defined.

[v2: Rebase on top staging/zcache: Fix/improve zcache writeback code, tie to a config option]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 108 +++++++++++++++++++++++------------
 1 file changed, 73 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 5daa0be..5ad915a 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -138,32 +138,88 @@ static DEFINE_PER_CPU(struct zcache_preload, zcache_preloads) = { 0, };
 static long zcache_obj_count;
 static atomic_t zcache_obj_atomic = ATOMIC_INIT(0);
 static long zcache_obj_count_max;
+static inline void inc_zcache_obj_count(void)
+{
+	zcache_obj_count = atomic_inc_return(&zcache_obj_atomic);
+	if (zcache_obj_count > zcache_obj_count_max)
+		zcache_obj_count_max = zcache_obj_count;
+}
+
 static long zcache_objnode_count;
 static atomic_t zcache_objnode_atomic = ATOMIC_INIT(0);
 static long zcache_objnode_count_max;
+static inline void inc_zcache_objnode_count(void)
+{
+	zcache_objnode_count = atomic_inc_return(&zcache_objnode_atomic);
+	if (zcache_objnode_count > zcache_objnode_count_max)
+		zcache_objnode_count_max = zcache_objnode_count;
+};
 static u64 zcache_eph_zbytes;
 static atomic_long_t zcache_eph_zbytes_atomic = ATOMIC_INIT(0);
 static u64 zcache_eph_zbytes_max;
+static inline void inc_zcache_eph_zbytes(unsigned clen)
+{
+	zcache_eph_zbytes = atomic_long_add_return(clen, &zcache_eph_zbytes_atomic);
+	if (zcache_eph_zbytes > zcache_eph_zbytes_max)
+		zcache_eph_zbytes_max = zcache_eph_zbytes;
+};
 static u64 zcache_pers_zbytes;
 static atomic_long_t zcache_pers_zbytes_atomic = ATOMIC_INIT(0);
 static u64 zcache_pers_zbytes_max;
+static inline void inc_zcache_pers_zbytes(unsigned clen)
+{
+	zcache_pers_zbytes = atomic_long_add_return(clen, &zcache_pers_zbytes_atomic);
+	if (zcache_pers_zbytes > zcache_pers_zbytes_max)
+		zcache_pers_zbytes_max = zcache_pers_zbytes;
+}
 static long zcache_eph_pageframes;
 static atomic_t zcache_eph_pageframes_atomic = ATOMIC_INIT(0);
 static long zcache_eph_pageframes_max;
+static inline void inc_zcache_eph_pageframes(void)
+{
+	zcache_eph_pageframes = atomic_inc_return(&zcache_eph_pageframes_atomic);
+	if (zcache_eph_pageframes > zcache_eph_pageframes_max)
+		zcache_eph_pageframes_max = zcache_eph_pageframes;
+};
 static long zcache_pers_pageframes;
 static atomic_t zcache_pers_pageframes_atomic = ATOMIC_INIT(0);
 static long zcache_pers_pageframes_max;
+static inline void inc_zcache_pers_pageframes(void)
+{
+	zcache_pers_pageframes = atomic_inc_return(&zcache_pers_pageframes_atomic);
+	if (zcache_pers_pageframes > zcache_pers_pageframes_max)
+		zcache_pers_pageframes_max = zcache_pers_pageframes;
+}
 static long zcache_pageframes_alloced;
 static atomic_t zcache_pageframes_alloced_atomic = ATOMIC_INIT(0);
+static inline void inc_zcache_pageframes_alloced(void)
+{
+	zcache_pageframes_alloced = atomic_inc_return(&zcache_pageframes_alloced_atomic);
+};
 static long zcache_pageframes_freed;
 static atomic_t zcache_pageframes_freed_atomic = ATOMIC_INIT(0);
+static inline void inc_zcache_pageframes_freed(void)
+{
+	zcache_pageframes_freed = atomic_inc_return(&zcache_pageframes_freed_atomic);
+}
 static long zcache_eph_zpages;
 static atomic_t zcache_eph_zpages_atomic = ATOMIC_INIT(0);
 static long zcache_eph_zpages_max;
+static inline void inc_zcache_eph_zpages(void)
+{
+	zcache_eph_zpages = atomic_inc_return(&zcache_eph_zpages_atomic);
+	if (zcache_eph_zpages > zcache_eph_zpages_max)
+		zcache_eph_zpages_max = zcache_eph_zpages;
+}
 static long zcache_pers_zpages;
 static atomic_t zcache_pers_zpages_atomic = ATOMIC_INIT(0);
 static long zcache_pers_zpages_max;
-
+static inline void inc_zcache_pers_zpages(void)
+{
+	zcache_pers_zpages = atomic_inc_return(&zcache_pers_zpages_atomic);
+	if (zcache_pers_zpages > zcache_pers_zpages_max)
+		zcache_pers_zpages_max = zcache_pers_zpages;
+}
 /* but for the rest of these, counting races are ok */
 static unsigned long zcache_flush_total;
 static unsigned long zcache_flush_found;
@@ -421,9 +477,7 @@ static struct tmem_objnode *zcache_objnode_alloc(struct tmem_pool *pool)
 		}
 	}
 	BUG_ON(objnode == NULL);
-	zcache_objnode_count = atomic_inc_return(&zcache_objnode_atomic);
-	if (zcache_objnode_count > zcache_objnode_count_max)
-		zcache_objnode_count_max = zcache_objnode_count;
+	inc_zcache_objnode_count();
 	return objnode;
 }
 
@@ -445,9 +499,7 @@ static struct tmem_obj *zcache_obj_alloc(struct tmem_pool *pool)
 	obj = kp->obj;
 	BUG_ON(obj == NULL);
 	kp->obj = NULL;
-	zcache_obj_count = atomic_inc_return(&zcache_obj_atomic);
-	if (zcache_obj_count > zcache_obj_count_max)
-		zcache_obj_count_max = zcache_obj_count;
+	inc_zcache_obj_count();
 	return obj;
 }
 
@@ -471,8 +523,7 @@ static struct page *zcache_alloc_page(void)
 	struct page *page = alloc_page(ZCACHE_GFP_MASK);
 
 	if (page != NULL)
-		zcache_pageframes_alloced =
-			atomic_inc_return(&zcache_pageframes_alloced_atomic);
+		inc_zcache_pageframes_alloced();
 	return page;
 }
 
@@ -484,8 +535,7 @@ static void zcache_free_page(struct page *page)
 	if (page == NULL)
 		BUG();
 	__free_page(page);
-	zcache_pageframes_freed =
-		atomic_inc_return(&zcache_pageframes_freed_atomic);
+	inc_zcache_pageframes_freed();
 	curr_pageframes = zcache_pageframes_alloced -
 			atomic_read(&zcache_pageframes_freed_atomic) -
 			atomic_read(&zcache_eph_pageframes_atomic) -
@@ -550,19 +600,11 @@ static void *zcache_pampd_eph_create(char *data, size_t size, bool raw,
 create_in_new_page:
 	pampd = (void *)zbud_create_prep(th, true, cdata, clen, newpage);
 	BUG_ON(pampd == NULL);
-	zcache_eph_pageframes =
-		atomic_inc_return(&zcache_eph_pageframes_atomic);
-	if (zcache_eph_pageframes > zcache_eph_pageframes_max)
-		zcache_eph_pageframes_max = zcache_eph_pageframes;
+	inc_zcache_eph_pageframes();
 
 got_pampd:
-	zcache_eph_zbytes =
-		atomic_long_add_return(clen, &zcache_eph_zbytes_atomic);
-	if (zcache_eph_zbytes > zcache_eph_zbytes_max)
-		zcache_eph_zbytes_max = zcache_eph_zbytes;
-	zcache_eph_zpages = atomic_inc_return(&zcache_eph_zpages_atomic);
-	if (zcache_eph_zpages > zcache_eph_zpages_max)
-		zcache_eph_zpages_max = zcache_eph_zpages;
+	inc_zcache_eph_zbytes(clen);
+	inc_zcache_eph_zpages();
 	if (ramster_enabled && raw)
 		ramster_count_foreign_pages(true, 1);
 out:
@@ -632,19 +674,11 @@ create_pampd:
 create_in_new_page:
 	pampd = (void *)zbud_create_prep(th, false, cdata, clen, newpage);
 	BUG_ON(pampd == NULL);
-	zcache_pers_pageframes =
-		atomic_inc_return(&zcache_pers_pageframes_atomic);
-	if (zcache_pers_pageframes > zcache_pers_pageframes_max)
-		zcache_pers_pageframes_max = zcache_pers_pageframes;
+	inc_zcache_pers_pageframes();
 
 got_pampd:
-	zcache_pers_zpages = atomic_inc_return(&zcache_pers_zpages_atomic);
-	if (zcache_pers_zpages > zcache_pers_zpages_max)
-		zcache_pers_zpages_max = zcache_pers_zpages;
-	zcache_pers_zbytes =
-		atomic_long_add_return(clen, &zcache_pers_zbytes_atomic);
-	if (zcache_pers_zbytes > zcache_pers_zbytes_max)
-		zcache_pers_zbytes_max = zcache_pers_zbytes;
+	inc_zcache_pers_zpages();
+	inc_zcache_pers_zbytes(clen);
 	if (ramster_enabled && raw)
 		ramster_count_foreign_pages(false, 1);
 out:
@@ -990,6 +1024,11 @@ out:
 
 static atomic_t zcache_outstanding_writeback_pages_atomic = ATOMIC_INIT(0);
 
+static inline void inc_zcache_outstanding_writeback_pages(void)
+{
+	zcache_outstanding_writeback_pages =
+	    atomic_inc_return(&zcache_outstanding_writeback_pages_atomic);
+}
 static void unswiz(struct tmem_oid oid, u32 index,
 				unsigned *type, pgoff_t *offset);
 
@@ -1119,8 +1158,7 @@ static int zcache_frontswap_writeback_zpage(int type, pgoff_t offset,
 	 */
 	(void)__swap_writepage(page, &wbc, zcache_end_swap_write);
 	page_cache_release(page);
-	zcache_outstanding_writeback_pages =
-	    atomic_inc_return(&zcache_outstanding_writeback_pages_atomic);
+	inc_zcache_outstanding_writeback_pages();
 
 	return 0;
 }
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/16] zcache: Provide accessory functions for counter decrease.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 01/16] zcache: s/int/bool/ on the various options Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 02/16] zcache: Provide accessory functions for counter increase Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 04/16] zcache: The last of the atomic reads has now an accessory function Konrad Rzeszutek Wilk
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

This way we can have all wrapped with these functions and
can disable/enable this with CONFIG_DEBUG_FS.

[v2: Rebase on top of staging/zcache: Fix/improve zcache writeback code, tie to a config option]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 96 +++++++++++++++++++++---------------
 1 file changed, 57 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 5ad915a..50a408a 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -144,8 +144,12 @@ static inline void inc_zcache_obj_count(void)
 	if (zcache_obj_count > zcache_obj_count_max)
 		zcache_obj_count_max = zcache_obj_count;
 }
-
 static long zcache_objnode_count;
+static inline void dec_zcache_obj_count(void)
+{
+	zcache_obj_count = atomic_dec_return(&zcache_obj_atomic);
+	BUG_ON(zcache_obj_count < 0);
+};
 static atomic_t zcache_objnode_atomic = ATOMIC_INIT(0);
 static long zcache_objnode_count_max;
 static inline void inc_zcache_objnode_count(void)
@@ -154,6 +158,11 @@ static inline void inc_zcache_objnode_count(void)
 	if (zcache_objnode_count > zcache_objnode_count_max)
 		zcache_objnode_count_max = zcache_objnode_count;
 };
+static inline void dec_zcache_objnode_count(void)
+{
+	zcache_objnode_count = atomic_dec_return(&zcache_objnode_atomic);
+	BUG_ON(zcache_objnode_count < 0);
+};
 static u64 zcache_eph_zbytes;
 static atomic_long_t zcache_eph_zbytes_atomic = ATOMIC_INIT(0);
 static u64 zcache_eph_zbytes_max;
@@ -163,6 +172,10 @@ static inline void inc_zcache_eph_zbytes(unsigned clen)
 	if (zcache_eph_zbytes > zcache_eph_zbytes_max)
 		zcache_eph_zbytes_max = zcache_eph_zbytes;
 };
+static inline void dec_zcache_eph_zbytes(unsigned zsize)
+{
+	zcache_eph_zbytes = atomic_long_sub_return(zsize, &zcache_eph_zbytes_atomic);
+};
 static u64 zcache_pers_zbytes;
 static atomic_long_t zcache_pers_zbytes_atomic = ATOMIC_INIT(0);
 static u64 zcache_pers_zbytes_max;
@@ -173,6 +186,10 @@ static inline void inc_zcache_pers_zbytes(unsigned clen)
 		zcache_pers_zbytes_max = zcache_pers_zbytes;
 }
 static long zcache_eph_pageframes;
+static inline void dec_zcache_pers_zbytes(unsigned zsize)
+{
+	zcache_pers_zbytes = atomic_long_sub_return(zsize, &zcache_pers_zbytes_atomic);
+}
 static atomic_t zcache_eph_pageframes_atomic = ATOMIC_INIT(0);
 static long zcache_eph_pageframes_max;
 static inline void inc_zcache_eph_pageframes(void)
@@ -182,6 +199,10 @@ static inline void inc_zcache_eph_pageframes(void)
 		zcache_eph_pageframes_max = zcache_eph_pageframes;
 };
 static long zcache_pers_pageframes;
+static inline void dec_zcache_eph_pageframes(void)
+{
+	zcache_eph_pageframes = atomic_dec_return(&zcache_eph_pageframes_atomic);
+};
 static atomic_t zcache_pers_pageframes_atomic = ATOMIC_INIT(0);
 static long zcache_pers_pageframes_max;
 static inline void inc_zcache_pers_pageframes(void)
@@ -191,6 +212,10 @@ static inline void inc_zcache_pers_pageframes(void)
 		zcache_pers_pageframes_max = zcache_pers_pageframes;
 }
 static long zcache_pageframes_alloced;
+static inline void dec_zcache_pers_pageframes(void)
+{
+	zcache_pers_pageframes = atomic_dec_return(&zcache_pers_pageframes_atomic);
+}
 static atomic_t zcache_pageframes_alloced_atomic = ATOMIC_INIT(0);
 static inline void inc_zcache_pageframes_alloced(void)
 {
@@ -212,6 +237,10 @@ static inline void inc_zcache_eph_zpages(void)
 		zcache_eph_zpages_max = zcache_eph_zpages;
 }
 static long zcache_pers_zpages;
+static inline void dec_zcache_eph_zpages(unsigned zpages)
+{
+	zcache_eph_zpages = atomic_sub_return(zpages, &zcache_eph_zpages_atomic);
+}
 static atomic_t zcache_pers_zpages_atomic = ATOMIC_INIT(0);
 static long zcache_pers_zpages_max;
 static inline void inc_zcache_pers_zpages(void)
@@ -220,6 +249,10 @@ static inline void inc_zcache_pers_zpages(void)
 	if (zcache_pers_zpages > zcache_pers_zpages_max)
 		zcache_pers_zpages_max = zcache_pers_zpages;
 }
+static inline void dec_zcache_pers_zpages(unsigned zpages)
+{
+	zcache_pers_zpages = atomic_sub_return(zpages, &zcache_pers_zpages_atomic);
+}
 /* but for the rest of these, counting races are ok */
 static unsigned long zcache_flush_total;
 static unsigned long zcache_flush_found;
@@ -484,9 +517,7 @@ static struct tmem_objnode *zcache_objnode_alloc(struct tmem_pool *pool)
 static void zcache_objnode_free(struct tmem_objnode *objnode,
 					struct tmem_pool *pool)
 {
-	zcache_objnode_count =
-		atomic_dec_return(&zcache_objnode_atomic);
-	BUG_ON(zcache_objnode_count < 0);
+	dec_zcache_objnode_count();
 	kmem_cache_free(zcache_objnode_cache, objnode);
 }
 
@@ -505,9 +536,7 @@ static struct tmem_obj *zcache_obj_alloc(struct tmem_pool *pool)
 
 static void zcache_obj_free(struct tmem_obj *obj, struct tmem_pool *pool)
 {
-	zcache_obj_count =
-		atomic_dec_return(&zcache_obj_atomic);
-	BUG_ON(zcache_obj_count < 0);
+	dec_zcache_obj_count();
 	kmem_cache_free(zcache_obj_cache, obj);
 }
 
@@ -827,20 +856,14 @@ static int zcache_pampd_get_data_and_free(char *data, size_t *sizep, bool raw,
 					&zsize, &zpages);
 	if (eph) {
 		if (page)
-			zcache_eph_pageframes =
-			    atomic_dec_return(&zcache_eph_pageframes_atomic);
-		zcache_eph_zpages =
-		    atomic_sub_return(zpages, &zcache_eph_zpages_atomic);
-		zcache_eph_zbytes =
-		    atomic_long_sub_return(zsize, &zcache_eph_zbytes_atomic);
+			dec_zcache_eph_pageframes();
+		dec_zcache_eph_zpages(zpages);
+		dec_zcache_eph_zbytes(zsize);
 	} else {
 		if (page)
-			zcache_pers_pageframes =
-			    atomic_dec_return(&zcache_pers_pageframes_atomic);
-		zcache_pers_zpages =
-		    atomic_sub_return(zpages, &zcache_pers_zpages_atomic);
-		zcache_pers_zbytes =
-		    atomic_long_sub_return(zsize, &zcache_pers_zbytes_atomic);
+			dec_zcache_pers_pageframes();
+		dec_zcache_pers_zpages(zpages);
+		dec_zcache_pers_zbytes(zsize);
 	}
 	if (!is_local_client(pool->client))
 		ramster_count_foreign_pages(eph, -1);
@@ -870,23 +893,17 @@ static void zcache_pampd_free(void *pampd, struct tmem_pool *pool,
 		page = zbud_free_and_delist((struct zbudref *)pampd,
 						true, &zsize, &zpages);
 		if (page)
-			zcache_eph_pageframes =
-			    atomic_dec_return(&zcache_eph_pageframes_atomic);
-		zcache_eph_zpages =
-		    atomic_sub_return(zpages, &zcache_eph_zpages_atomic);
-		zcache_eph_zbytes =
-		    atomic_long_sub_return(zsize, &zcache_eph_zbytes_atomic);
+			dec_zcache_eph_pageframes();
+		dec_zcache_eph_zpages(zpages);
+		dec_zcache_eph_zbytes(zsize);
 		/* FIXME CONFIG_RAMSTER... check acct parameter? */
 	} else {
 		page = zbud_free_and_delist((struct zbudref *)pampd,
 						false, &zsize, &zpages);
 		if (page)
-			zcache_pers_pageframes =
-			    atomic_dec_return(&zcache_pers_pageframes_atomic);
-		zcache_pers_zpages =
-		     atomic_sub_return(zpages, &zcache_pers_zpages_atomic);
-		zcache_pers_zbytes =
-		    atomic_long_sub_return(zsize, &zcache_pers_zbytes_atomic);
+			dec_zcache_pers_pageframes();
+		dec_zcache_pers_zpages(zpages);
+		dec_zcache_pers_zbytes(zsize);
 	}
 	if (!is_local_client(pool->client))
 		ramster_count_foreign_pages(is_ephemeral(pool), -1);
@@ -1008,13 +1025,10 @@ static struct page *zcache_evict_eph_pageframe(void)
 	page = zbud_evict_pageframe_lru(&zsize, &zpages);
 	if (page == NULL)
 		goto out;
-	zcache_eph_zbytes = atomic_long_sub_return(zsize,
-					&zcache_eph_zbytes_atomic);
-	zcache_eph_zpages = atomic_sub_return(zpages,
-					&zcache_eph_zpages_atomic);
+	dec_zcache_eph_zbytes(zsize);
+	dec_zcache_eph_zpages(zpages);
 	zcache_evicted_eph_zpages += zpages;
-	zcache_eph_pageframes =
-		atomic_dec_return(&zcache_eph_pageframes_atomic);
+	dec_zcache_eph_pageframes();
 	zcache_evicted_eph_pageframes++;
 out:
 	return page;
@@ -1029,6 +1043,11 @@ static inline void inc_zcache_outstanding_writeback_pages(void)
 	zcache_outstanding_writeback_pages =
 	    atomic_inc_return(&zcache_outstanding_writeback_pages_atomic);
 }
+static inline void dec_zcache_outstanding_writeback_pages(void)
+{
+	zcache_outstanding_writeback_pages =
+	  atomic_dec_return(&zcache_outstanding_writeback_pages_atomic);
+};
 static void unswiz(struct tmem_oid oid, u32 index,
 				unsigned *type, pgoff_t *offset);
 
@@ -1042,8 +1061,7 @@ static void unswiz(struct tmem_oid oid, u32 index,
 static void zcache_end_swap_write(struct bio *bio, int err)
 {
 	end_swap_bio_write(bio, err);
-	zcache_outstanding_writeback_pages =
-	  atomic_dec_return(&zcache_outstanding_writeback_pages_atomic);
+	dec_zcache_outstanding_writeback_pages();
 	zcache_writtenback_pages++;
 }
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/16] zcache: The last of the atomic reads has now an accessory function.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (2 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 03/16] zcache: Provide accessory functions for counter decrease Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 05/16] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

And now we can move the code ([inc|dec]_zcache_[*]) to their own file
with a header to make them nops or feed in debugfs.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 50a408a..b71e61b 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -253,6 +253,14 @@ static inline void dec_zcache_pers_zpages(unsigned zpages)
 {
 	zcache_pers_zpages = atomic_sub_return(zpages, &zcache_pers_zpages_atomic);
 }
+
+static inline unsigned long curr_pageframes_count(void)
+{
+	return zcache_pageframes_alloced -
+		atomic_read(&zcache_pageframes_freed_atomic) -
+		atomic_read(&zcache_eph_pageframes_atomic) -
+		atomic_read(&zcache_pers_pageframes_atomic);
+};
 /* but for the rest of these, counting races are ok */
 static unsigned long zcache_flush_total;
 static unsigned long zcache_flush_found;
@@ -565,10 +573,7 @@ static void zcache_free_page(struct page *page)
 		BUG();
 	__free_page(page);
 	inc_zcache_pageframes_freed();
-	curr_pageframes = zcache_pageframes_alloced -
-			atomic_read(&zcache_pageframes_freed_atomic) -
-			atomic_read(&zcache_eph_pageframes_atomic) -
-			atomic_read(&zcache_pers_pageframes_atomic);
+	curr_pageframes = curr_pageframes_count();
 	if (curr_pageframes > max_pageframes)
 		max_pageframes = curr_pageframes;
 	if (curr_pageframes < min_pageframes)
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/16] zcache: Fix compile warnings due to usage of debugfs_create_size_t
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (3 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 04/16] zcache: The last of the atomic reads has now an accessory function Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 06/16] zcache: Make the debug code use pr_debug Konrad Rzeszutek Wilk
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

When we compile we get tons of:
include/linux/debugfs.h:80:16: note: expected ‘size_t *’ but argument is
of type ‘long int *’
drivers/staging/zcache/zcache-main.c:279:2: warning: passing argument 4
of ‘debugfs_create_size_t’ from incompatible pointer type [enabled by d
efault]

which is b/c we end up using 'unsigned' or 'unsigned long' instead
of 'ssize_t'. So lets fix this up and use the proper type.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 163 ++++++++++++++++++-----------------
 1 file changed, 82 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index b71e61b..4bd4107 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -135,23 +135,23 @@ static struct kmem_cache *zcache_obj_cache;
 static DEFINE_PER_CPU(struct zcache_preload, zcache_preloads) = { 0, };
 
 /* we try to keep these statistics SMP-consistent */
-static long zcache_obj_count;
+static ssize_t zcache_obj_count;
 static atomic_t zcache_obj_atomic = ATOMIC_INIT(0);
-static long zcache_obj_count_max;
+static ssize_t zcache_obj_count_max;
 static inline void inc_zcache_obj_count(void)
 {
 	zcache_obj_count = atomic_inc_return(&zcache_obj_atomic);
 	if (zcache_obj_count > zcache_obj_count_max)
 		zcache_obj_count_max = zcache_obj_count;
 }
-static long zcache_objnode_count;
+static ssize_t zcache_objnode_count;
 static inline void dec_zcache_obj_count(void)
 {
 	zcache_obj_count = atomic_dec_return(&zcache_obj_atomic);
 	BUG_ON(zcache_obj_count < 0);
 };
 static atomic_t zcache_objnode_atomic = ATOMIC_INIT(0);
-static long zcache_objnode_count_max;
+static ssize_t zcache_objnode_count_max;
 static inline void inc_zcache_objnode_count(void)
 {
 	zcache_objnode_count = atomic_inc_return(&zcache_objnode_atomic);
@@ -185,64 +185,65 @@ static inline void inc_zcache_pers_zbytes(unsigned clen)
 	if (zcache_pers_zbytes > zcache_pers_zbytes_max)
 		zcache_pers_zbytes_max = zcache_pers_zbytes;
 }
-static long zcache_eph_pageframes;
+static ssize_t zcache_eph_pageframes;
 static inline void dec_zcache_pers_zbytes(unsigned zsize)
 {
 	zcache_pers_zbytes = atomic_long_sub_return(zsize, &zcache_pers_zbytes_atomic);
 }
 static atomic_t zcache_eph_pageframes_atomic = ATOMIC_INIT(0);
-static long zcache_eph_pageframes_max;
+static ssize_t zcache_eph_pageframes_max;
 static inline void inc_zcache_eph_pageframes(void)
 {
 	zcache_eph_pageframes = atomic_inc_return(&zcache_eph_pageframes_atomic);
 	if (zcache_eph_pageframes > zcache_eph_pageframes_max)
 		zcache_eph_pageframes_max = zcache_eph_pageframes;
 };
-static long zcache_pers_pageframes;
+static ssize_t zcache_pers_pageframes;
 static inline void dec_zcache_eph_pageframes(void)
 {
 	zcache_eph_pageframes = atomic_dec_return(&zcache_eph_pageframes_atomic);
 };
 static atomic_t zcache_pers_pageframes_atomic = ATOMIC_INIT(0);
-static long zcache_pers_pageframes_max;
+static ssize_t zcache_pers_pageframes_max;
 static inline void inc_zcache_pers_pageframes(void)
 {
 	zcache_pers_pageframes = atomic_inc_return(&zcache_pers_pageframes_atomic);
 	if (zcache_pers_pageframes > zcache_pers_pageframes_max)
 		zcache_pers_pageframes_max = zcache_pers_pageframes;
 }
-static long zcache_pageframes_alloced;
+static ssize_t zcache_pageframes_alloced;
 static inline void dec_zcache_pers_pageframes(void)
 {
 	zcache_pers_pageframes = atomic_dec_return(&zcache_pers_pageframes_atomic);
 }
 static atomic_t zcache_pageframes_alloced_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_pageframes_freed;
+static atomic_t zcache_pageframes_freed_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_eph_zpages;
 static inline void inc_zcache_pageframes_alloced(void)
 {
 	zcache_pageframes_alloced = atomic_inc_return(&zcache_pageframes_alloced_atomic);
 };
-static long zcache_pageframes_freed;
-static atomic_t zcache_pageframes_freed_atomic = ATOMIC_INIT(0);
 static inline void inc_zcache_pageframes_freed(void)
 {
 	zcache_pageframes_freed = atomic_inc_return(&zcache_pageframes_freed_atomic);
 }
-static long zcache_eph_zpages;
+static ssize_t zcache_eph_zpages;
 static atomic_t zcache_eph_zpages_atomic = ATOMIC_INIT(0);
-static long zcache_eph_zpages_max;
+static ssize_t zcache_eph_zpages_max;
 static inline void inc_zcache_eph_zpages(void)
 {
 	zcache_eph_zpages = atomic_inc_return(&zcache_eph_zpages_atomic);
 	if (zcache_eph_zpages > zcache_eph_zpages_max)
 		zcache_eph_zpages_max = zcache_eph_zpages;
 }
-static long zcache_pers_zpages;
+static ssize_t zcache_pers_zpages;
 static inline void dec_zcache_eph_zpages(unsigned zpages)
 {
 	zcache_eph_zpages = atomic_sub_return(zpages, &zcache_eph_zpages_atomic);
 }
 static atomic_t zcache_pers_zpages_atomic = ATOMIC_INIT(0);
-static long zcache_pers_zpages_max;
+static ssize_t zcache_pers_zpages_max;
 static inline void inc_zcache_pers_zpages(void)
 {
 	zcache_pers_zpages = atomic_inc_return(&zcache_pers_zpages_atomic);
@@ -262,31 +263,31 @@ static inline unsigned long curr_pageframes_count(void)
 		atomic_read(&zcache_pers_pageframes_atomic);
 };
 /* but for the rest of these, counting races are ok */
-static unsigned long zcache_flush_total;
-static unsigned long zcache_flush_found;
-static unsigned long zcache_flobj_total;
-static unsigned long zcache_flobj_found;
-static unsigned long zcache_failed_eph_puts;
-static unsigned long zcache_failed_pers_puts;
-static unsigned long zcache_failed_getfreepages;
-static unsigned long zcache_failed_alloc;
-static unsigned long zcache_put_to_flush;
-static unsigned long zcache_compress_poor;
-static unsigned long zcache_mean_compress_poor;
-static unsigned long zcache_eph_ate_tail;
-static unsigned long zcache_eph_ate_tail_failed;
-static unsigned long zcache_pers_ate_eph;
-static unsigned long zcache_pers_ate_eph_failed;
-static unsigned long zcache_evicted_eph_zpages;
-static unsigned long zcache_evicted_eph_pageframes;
-static unsigned long zcache_last_active_file_pageframes;
-static unsigned long zcache_last_inactive_file_pageframes;
-static unsigned long zcache_last_active_anon_pageframes;
-static unsigned long zcache_last_inactive_anon_pageframes;
-static unsigned long zcache_eph_nonactive_puts_ignored;
-static unsigned long zcache_pers_nonactive_puts_ignored;
-static unsigned long zcache_writtenback_pages;
-static long zcache_outstanding_writeback_pages;
+static ssize_t zcache_flush_total;
+static ssize_t zcache_flush_found;
+static ssize_t zcache_flobj_total;
+static ssize_t zcache_flobj_found;
+static ssize_t zcache_failed_eph_puts;
+static ssize_t zcache_failed_pers_puts;
+static ssize_t zcache_failed_getfreepages;
+static ssize_t zcache_failed_alloc;
+static ssize_t zcache_put_to_flush;
+static ssize_t zcache_compress_poor;
+static ssize_t zcache_mean_compress_poor;
+static ssize_t zcache_eph_ate_tail;
+static ssize_t zcache_eph_ate_tail_failed;
+static ssize_t zcache_pers_ate_eph;
+static ssize_t zcache_pers_ate_eph_failed;
+static ssize_t zcache_evicted_eph_zpages;
+static ssize_t zcache_evicted_eph_pageframes;
+static ssize_t zcache_last_active_file_pageframes;
+static ssize_t zcache_last_inactive_file_pageframes;
+static ssize_t zcache_last_active_anon_pageframes;
+static ssize_t zcache_last_inactive_anon_pageframes;
+static ssize_t zcache_eph_nonactive_puts_ignored;
+static ssize_t zcache_pers_nonactive_puts_ignored;
+static ssize_t zcache_writtenback_pages;
+static ssize_t zcache_outstanding_writeback_pages;
 
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
@@ -359,64 +360,64 @@ static int zcache_debugfs_init(void)
 /* developers can call this in case of ooms, e.g. to find memory leaks */
 void zcache_dump(void)
 {
-	pr_info("zcache: obj_count=%lu\n", zcache_obj_count);
-	pr_info("zcache: obj_count_max=%lu\n", zcache_obj_count_max);
-	pr_info("zcache: objnode_count=%lu\n", zcache_objnode_count);
-	pr_info("zcache: objnode_count_max=%lu\n", zcache_objnode_count_max);
-	pr_info("zcache: flush_total=%lu\n", zcache_flush_total);
-	pr_info("zcache: flush_found=%lu\n", zcache_flush_found);
-	pr_info("zcache: flobj_total=%lu\n", zcache_flobj_total);
-	pr_info("zcache: flobj_found=%lu\n", zcache_flobj_found);
-	pr_info("zcache: failed_eph_puts=%lu\n", zcache_failed_eph_puts);
-	pr_info("zcache: failed_pers_puts=%lu\n", zcache_failed_pers_puts);
-	pr_info("zcache: failed_get_free_pages=%lu\n",
+	pr_info("zcache: obj_count=%zd\n", zcache_obj_count);
+	pr_info("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
+	pr_info("zcache: objnode_count=%zd\n", zcache_objnode_count);
+	pr_info("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
+	pr_info("zcache: flush_total=%zd\n", zcache_flush_total);
+	pr_info("zcache: flush_found=%zd\n", zcache_flush_found);
+	pr_info("zcache: flobj_total=%zd\n", zcache_flobj_total);
+	pr_info("zcache: flobj_found=%zd\n", zcache_flobj_found);
+	pr_info("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
+	pr_info("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
+	pr_info("zcache: failed_get_free_pages=%zd\n",
 				zcache_failed_getfreepages);
-	pr_info("zcache: failed_alloc=%lu\n", zcache_failed_alloc);
-	pr_info("zcache: put_to_flush=%lu\n", zcache_put_to_flush);
-	pr_info("zcache: compress_poor=%lu\n", zcache_compress_poor);
-	pr_info("zcache: mean_compress_poor=%lu\n",
+	pr_info("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
+	pr_info("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
+	pr_info("zcache: compress_poor=%zd\n", zcache_compress_poor);
+	pr_info("zcache: mean_compress_poor=%zd\n",
 				zcache_mean_compress_poor);
-	pr_info("zcache: eph_ate_tail=%lu\n", zcache_eph_ate_tail);
-	pr_info("zcache: eph_ate_tail_failed=%lu\n",
+	pr_info("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
+	pr_info("zcache: eph_ate_tail_failed=%zd\n",
 				zcache_eph_ate_tail_failed);
-	pr_info("zcache: pers_ate_eph=%lu\n", zcache_pers_ate_eph);
-	pr_info("zcache: pers_ate_eph_failed=%lu\n",
+	pr_info("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
+	pr_info("zcache: pers_ate_eph_failed=%zd\n",
 				zcache_pers_ate_eph_failed);
-	pr_info("zcache: evicted_eph_zpages=%lu\n", zcache_evicted_eph_zpages);
-	pr_info("zcache: evicted_eph_pageframes=%lu\n",
+	pr_info("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
+	pr_info("zcache: evicted_eph_pageframes=%zd\n",
 				zcache_evicted_eph_pageframes);
-	pr_info("zcache: eph_pageframes=%lu\n", zcache_eph_pageframes);
-	pr_info("zcache: eph_pageframes_max=%lu\n", zcache_eph_pageframes_max);
-	pr_info("zcache: pers_pageframes=%lu\n", zcache_pers_pageframes);
-	pr_info("zcache: pers_pageframes_max=%lu\n",
+	pr_info("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
+	pr_info("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
+	pr_info("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
+	pr_info("zcache: pers_pageframes_max=%zd\n",
 				zcache_pers_pageframes_max);
-	pr_info("zcache: eph_zpages=%lu\n", zcache_eph_zpages);
-	pr_info("zcache: eph_zpages_max=%lu\n", zcache_eph_zpages_max);
-	pr_info("zcache: pers_zpages=%lu\n", zcache_pers_zpages);
-	pr_info("zcache: pers_zpages_max=%lu\n", zcache_pers_zpages_max);
-	pr_info("zcache: last_active_file_pageframes=%lu\n",
+	pr_info("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
+	pr_info("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
+	pr_info("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
+	pr_info("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
+	pr_info("zcache: last_active_file_pageframes=%zd\n",
 				zcache_last_active_file_pageframes);
-	pr_info("zcache: last_inactive_file_pageframes=%lu\n",
+	pr_info("zcache: last_inactive_file_pageframes=%zd\n",
 				zcache_last_inactive_file_pageframes);
-	pr_info("zcache: last_active_anon_pageframes=%lu\n",
+	pr_info("zcache: last_active_anon_pageframes=%zd\n",
 				zcache_last_active_anon_pageframes);
-	pr_info("zcache: last_inactive_anon_pageframes=%lu\n",
+	pr_info("zcache: last_inactive_anon_pageframes=%zd\n",
 				zcache_last_inactive_anon_pageframes);
-	pr_info("zcache: eph_nonactive_puts_ignored=%lu\n",
+	pr_info("zcache: eph_nonactive_puts_ignored=%zd\n",
 				zcache_eph_nonactive_puts_ignored);
-	pr_info("zcache: pers_nonactive_puts_ignored=%lu\n",
+	pr_info("zcache: pers_nonactive_puts_ignored=%zd\n",
 				zcache_pers_nonactive_puts_ignored);
 	pr_info("zcache: eph_zbytes=%llu\n",
-				(unsigned long long)zcache_eph_zbytes);
+				zcache_eph_zbytes);
 	pr_info("zcache: eph_zbytes_max=%llu\n",
-				(unsigned long long)zcache_eph_zbytes_max);
+				zcache_eph_zbytes_max);
 	pr_info("zcache: pers_zbytes=%llu\n",
-				(unsigned long long)zcache_pers_zbytes);
+				zcache_pers_zbytes);
 	pr_info("zcache: pers_zbytes_max=%llu\n",
-				(unsigned long long)zcache_pers_zbytes_max);
-	pr_info("zcache: outstanding_writeback_pages=%lu\n",
+				zcache_pers_zbytes_max);
+	pr_info("zcache: outstanding_writeback_pages=%zd\n",
 				zcache_outstanding_writeback_pages);
-	pr_info("zcache: writtenback_pages=%lu\n", zcache_writtenback_pages);
+	pr_info("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
 }
 #endif
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/16] zcache: Make the debug code use pr_debug
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (4 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 05/16] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 07/16] zcache: Move debugfs code out of zcache-main.c file Konrad Rzeszutek Wilk
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

as if you are debugging this driver you would be using 'debug'
on the command line anyhow - and this would dump the debug
data on the proper loglevel.

While at it also remove the unconditional #define ZCACHE_DEBUG.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 85 +++++++++++++++++-------------------
 1 file changed, 41 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 4bd4107..d4bf4a2 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -355,71 +355,68 @@ static int zcache_debugfs_init(void)
 #undef	zdfs64
 #endif
 
-#define ZCACHE_DEBUG
-#ifdef ZCACHE_DEBUG
 /* developers can call this in case of ooms, e.g. to find memory leaks */
 void zcache_dump(void)
 {
-	pr_info("zcache: obj_count=%zd\n", zcache_obj_count);
-	pr_info("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
-	pr_info("zcache: objnode_count=%zd\n", zcache_objnode_count);
-	pr_info("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
-	pr_info("zcache: flush_total=%zd\n", zcache_flush_total);
-	pr_info("zcache: flush_found=%zd\n", zcache_flush_found);
-	pr_info("zcache: flobj_total=%zd\n", zcache_flobj_total);
-	pr_info("zcache: flobj_found=%zd\n", zcache_flobj_found);
-	pr_info("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
-	pr_info("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
-	pr_info("zcache: failed_get_free_pages=%zd\n",
+	pr_debug("zcache: obj_count=%zd\n", zcache_obj_count);
+	pr_debug("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
+	pr_debug("zcache: objnode_count=%zd\n", zcache_objnode_count);
+	pr_debug("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
+	pr_debug("zcache: flush_total=%zd\n", zcache_flush_total);
+	pr_debug("zcache: flush_found=%zd\n", zcache_flush_found);
+	pr_debug("zcache: flobj_total=%zd\n", zcache_flobj_total);
+	pr_debug("zcache: flobj_found=%zd\n", zcache_flobj_found);
+	pr_debug("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
+	pr_debug("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
+	pr_debug("zcache: failed_get_free_pages=%zd\n",
 				zcache_failed_getfreepages);
-	pr_info("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
-	pr_info("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
-	pr_info("zcache: compress_poor=%zd\n", zcache_compress_poor);
-	pr_info("zcache: mean_compress_poor=%zd\n",
+	pr_debug("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
+	pr_debug("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
+	pr_debug("zcache: compress_poor=%zd\n", zcache_compress_poor);
+	pr_debug("zcache: mean_compress_poor=%zd\n",
 				zcache_mean_compress_poor);
-	pr_info("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
-	pr_info("zcache: eph_ate_tail_failed=%zd\n",
+	pr_debug("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
+	pr_debug("zcache: eph_ate_tail_failed=%zd\n",
 				zcache_eph_ate_tail_failed);
-	pr_info("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
-	pr_info("zcache: pers_ate_eph_failed=%zd\n",
+	pr_debug("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
+	pr_debug("zcache: pers_ate_eph_failed=%zd\n",
 				zcache_pers_ate_eph_failed);
-	pr_info("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
-	pr_info("zcache: evicted_eph_pageframes=%zd\n",
+	pr_debug("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
+	pr_debug("zcache: evicted_eph_pageframes=%zd\n",
 				zcache_evicted_eph_pageframes);
-	pr_info("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
-	pr_info("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
-	pr_info("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
-	pr_info("zcache: pers_pageframes_max=%zd\n",
+	pr_debug("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
+	pr_debug("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
+	pr_debug("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
+	pr_debug("zcache: pers_pageframes_max=%zd\n",
 				zcache_pers_pageframes_max);
-	pr_info("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
-	pr_info("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
-	pr_info("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
-	pr_info("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
-	pr_info("zcache: last_active_file_pageframes=%zd\n",
+	pr_debug("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
+	pr_debug("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
+	pr_debug("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
+	pr_debug("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
+	pr_debug("zcache: last_active_file_pageframes=%zd\n",
 				zcache_last_active_file_pageframes);
-	pr_info("zcache: last_inactive_file_pageframes=%zd\n",
+	pr_debug("zcache: last_inactive_file_pageframes=%zd\n",
 				zcache_last_inactive_file_pageframes);
-	pr_info("zcache: last_active_anon_pageframes=%zd\n",
+	pr_debug("zcache: last_active_anon_pageframes=%zd\n",
 				zcache_last_active_anon_pageframes);
-	pr_info("zcache: last_inactive_anon_pageframes=%zd\n",
+	pr_debug("zcache: last_inactive_anon_pageframes=%zd\n",
 				zcache_last_inactive_anon_pageframes);
-	pr_info("zcache: eph_nonactive_puts_ignored=%zd\n",
+	pr_debug("zcache: eph_nonactive_puts_ignored=%zd\n",
 				zcache_eph_nonactive_puts_ignored);
-	pr_info("zcache: pers_nonactive_puts_ignored=%zd\n",
+	pr_debug("zcache: pers_nonactive_puts_ignored=%zd\n",
 				zcache_pers_nonactive_puts_ignored);
-	pr_info("zcache: eph_zbytes=%llu\n",
+	pr_debug("zcache: eph_zbytes=%llu\n",
 				zcache_eph_zbytes);
-	pr_info("zcache: eph_zbytes_max=%llu\n",
+	pr_debug("zcache: eph_zbytes_max=%llu\n",
 				zcache_eph_zbytes_max);
-	pr_info("zcache: pers_zbytes=%llu\n",
+	pr_debug("zcache: pers_zbytes=%llu\n",
 				zcache_pers_zbytes);
-	pr_info("zcache: pers_zbytes_max=%llu\n",
+	pr_debug("zcache: pers_zbytes_max=%llu\n",
 				zcache_pers_zbytes_max);
-	pr_info("zcache: outstanding_writeback_pages=%zd\n",
+	pr_debug("zcache: outstanding_writeback_pages=%zd\n",
 				zcache_outstanding_writeback_pages);
-	pr_info("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
+	pr_debug("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
 }
-#endif
 
 /*
  * zcache core code starts here
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/16] zcache: Move debugfs code out of zcache-main.c file.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (5 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 06/16] zcache: Make the debug code use pr_debug Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 08/16] zcache/debug: Use an array to initialize/use debugfs attributes Konrad Rzeszutek Wilk
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

Note that at this point there is no CONFIG_ZCACHE_DEBUG
option in the Kconfig. So in effect all of the counters
are nop until that option gets re-introduced in:
zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/Makefile      |   1 +
 drivers/staging/zcache/debug.c       | 132 +++++++++++++++++
 drivers/staging/zcache/debug.h       | 187 ++++++++++++++++++++++++
 drivers/staging/zcache/zcache-main.c | 265 ++---------------------------------
 4 files changed, 328 insertions(+), 257 deletions(-)
 create mode 100644 drivers/staging/zcache/debug.c
 create mode 100644 drivers/staging/zcache/debug.h

diff --git a/drivers/staging/zcache/Makefile b/drivers/staging/zcache/Makefile
index 4711049..24fd6aa 100644
--- a/drivers/staging/zcache/Makefile
+++ b/drivers/staging/zcache/Makefile
@@ -1,4 +1,5 @@
 zcache-y	:=		zcache-main.o tmem.o zbud.o
+zcache-$(CONFIG_ZCACHE_DEBUG) += debug.o
 zcache-$(CONFIG_RAMSTER)	+=	ramster/ramster.o ramster/r2net.o
 zcache-$(CONFIG_RAMSTER)	+=	ramster/nodemanager.o ramster/tcp.o
 zcache-$(CONFIG_RAMSTER)	+=	ramster/heartbeat.o ramster/masklog.o
diff --git a/drivers/staging/zcache/debug.c b/drivers/staging/zcache/debug.c
new file mode 100644
index 0000000..622d5f3
--- /dev/null
+++ b/drivers/staging/zcache/debug.c
@@ -0,0 +1,132 @@
+#include <linux/atomic.h>
+#include "debug.h"
+
+#ifdef CONFIG_DEBUG_FS
+#include <linux/debugfs.h>
+#define	zdfs	debugfs_create_size_t
+#define	zdfs64	debugfs_create_u64
+int zcache_debugfs_init(void)
+{
+	struct dentry *root = debugfs_create_dir("zcache", NULL);
+	if (root == NULL)
+		return -ENXIO;
+
+	zdfs("obj_count", S_IRUGO, root, &zcache_obj_count);
+	zdfs("obj_count_max", S_IRUGO, root, &zcache_obj_count_max);
+	zdfs("objnode_count", S_IRUGO, root, &zcache_objnode_count);
+	zdfs("objnode_count_max", S_IRUGO, root, &zcache_objnode_count_max);
+	zdfs("flush_total", S_IRUGO, root, &zcache_flush_total);
+	zdfs("flush_found", S_IRUGO, root, &zcache_flush_found);
+	zdfs("flobj_total", S_IRUGO, root, &zcache_flobj_total);
+	zdfs("flobj_found", S_IRUGO, root, &zcache_flobj_found);
+	zdfs("failed_eph_puts", S_IRUGO, root, &zcache_failed_eph_puts);
+	zdfs("failed_pers_puts", S_IRUGO, root, &zcache_failed_pers_puts);
+	zdfs("failed_get_free_pages", S_IRUGO, root,
+				&zcache_failed_getfreepages);
+	zdfs("failed_alloc", S_IRUGO, root, &zcache_failed_alloc);
+	zdfs("put_to_flush", S_IRUGO, root, &zcache_put_to_flush);
+	zdfs("compress_poor", S_IRUGO, root, &zcache_compress_poor);
+	zdfs("mean_compress_poor", S_IRUGO, root, &zcache_mean_compress_poor);
+	zdfs("eph_ate_tail", S_IRUGO, root, &zcache_eph_ate_tail);
+	zdfs("eph_ate_tail_failed", S_IRUGO, root, &zcache_eph_ate_tail_failed);
+	zdfs("pers_ate_eph", S_IRUGO, root, &zcache_pers_ate_eph);
+	zdfs("pers_ate_eph_failed", S_IRUGO, root, &zcache_pers_ate_eph_failed);
+	zdfs("evicted_eph_zpages", S_IRUGO, root, &zcache_evicted_eph_zpages);
+	zdfs("evicted_eph_pageframes", S_IRUGO, root,
+				&zcache_evicted_eph_pageframes);
+	zdfs("eph_pageframes", S_IRUGO, root, &zcache_eph_pageframes);
+	zdfs("eph_pageframes_max", S_IRUGO, root, &zcache_eph_pageframes_max);
+	zdfs("pers_pageframes", S_IRUGO, root, &zcache_pers_pageframes);
+	zdfs("pers_pageframes_max", S_IRUGO, root, &zcache_pers_pageframes_max);
+	zdfs("eph_zpages", S_IRUGO, root, &zcache_eph_zpages);
+	zdfs("eph_zpages_max", S_IRUGO, root, &zcache_eph_zpages_max);
+	zdfs("pers_zpages", S_IRUGO, root, &zcache_pers_zpages);
+	zdfs("pers_zpages_max", S_IRUGO, root, &zcache_pers_zpages_max);
+	zdfs("last_active_file_pageframes", S_IRUGO, root,
+				&zcache_last_active_file_pageframes);
+	zdfs("last_inactive_file_pageframes", S_IRUGO, root,
+				&zcache_last_inactive_file_pageframes);
+	zdfs("last_active_anon_pageframes", S_IRUGO, root,
+				&zcache_last_active_anon_pageframes);
+	zdfs("last_inactive_anon_pageframes", S_IRUGO, root,
+				&zcache_last_inactive_anon_pageframes);
+	zdfs("eph_nonactive_puts_ignored", S_IRUGO, root,
+				&zcache_eph_nonactive_puts_ignored);
+	zdfs("pers_nonactive_puts_ignored", S_IRUGO, root,
+				&zcache_pers_nonactive_puts_ignored);
+	zdfs64("eph_zbytes", S_IRUGO, root, &zcache_eph_zbytes);
+	zdfs64("eph_zbytes_max", S_IRUGO, root, &zcache_eph_zbytes_max);
+	zdfs64("pers_zbytes", S_IRUGO, root, &zcache_pers_zbytes);
+	zdfs64("pers_zbytes_max", S_IRUGO, root, &zcache_pers_zbytes_max);
+	zdfs("outstanding_writeback_pages", S_IRUGO, root,
+				&zcache_outstanding_writeback_pages);
+	zdfs("writtenback_pages", S_IRUGO, root, &zcache_writtenback_pages);
+
+	return 0;
+}
+#undef	zdebugfs
+#undef	zdfs64
+
+/* developers can call this in case of ooms, e.g. to find memory leaks */
+void zcache_dump(void)
+{
+	pr_debug("zcache: obj_count=%zd\n", zcache_obj_count);
+	pr_debug("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
+	pr_debug("zcache: objnode_count=%zd\n", zcache_objnode_count);
+	pr_debug("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
+	pr_debug("zcache: flush_total=%zd\n", zcache_flush_total);
+	pr_debug("zcache: flush_found=%zd\n", zcache_flush_found);
+	pr_debug("zcache: flobj_total=%zd\n", zcache_flobj_total);
+	pr_debug("zcache: flobj_found=%zd\n", zcache_flobj_found);
+	pr_debug("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
+	pr_debug("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
+	pr_debug("zcache: failed_get_free_pages=%zd\n",
+				zcache_failed_getfreepages);
+	pr_debug("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
+	pr_debug("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
+	pr_debug("zcache: compress_poor=%zd\n", zcache_compress_poor);
+	pr_debug("zcache: mean_compress_poor=%zd\n",
+				zcache_mean_compress_poor);
+	pr_debug("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
+	pr_debug("zcache: eph_ate_tail_failed=%zd\n",
+				zcache_eph_ate_tail_failed);
+	pr_debug("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
+	pr_debug("zcache: pers_ate_eph_failed=%zd\n",
+				zcache_pers_ate_eph_failed);
+	pr_debug("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
+	pr_debug("zcache: evicted_eph_pageframes=%zd\n",
+				zcache_evicted_eph_pageframes);
+	pr_debug("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
+	pr_debug("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
+	pr_debug("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
+	pr_debug("zcache: pers_pageframes_max=%zd\n",
+				zcache_pers_pageframes_max);
+	pr_debug("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
+	pr_debug("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
+	pr_debug("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
+	pr_debug("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
+	pr_debug("zcache: last_active_file_pageframes=%zd\n",
+				zcache_last_active_file_pageframes);
+	pr_debug("zcache: last_inactive_file_pageframes=%zd\n",
+				zcache_last_inactive_file_pageframes);
+	pr_debug("zcache: last_active_anon_pageframes=%zd\n",
+				zcache_last_active_anon_pageframes);
+	pr_debug("zcache: last_inactive_anon_pageframes=%zd\n",
+				zcache_last_inactive_anon_pageframes);
+	pr_debug("zcache: eph_nonactive_puts_ignored=%zd\n",
+				zcache_eph_nonactive_puts_ignored);
+	pr_debug("zcache: pers_nonactive_puts_ignored=%zd\n",
+				zcache_pers_nonactive_puts_ignored);
+	pr_debug("zcache: eph_zbytes=%llu\n",
+				zcache_eph_zbytes);
+	pr_debug("zcache: eph_zbytes_max=%llu\n",
+				zcache_eph_zbytes_max);
+	pr_debug("zcache: pers_zbytes=%llu\n",
+				zcache_pers_zbytes);
+	pr_debug("zcache: pers_zbytes_max=%llu\n",
+				zcache_pers_zbytes_max);
+	pr_debug("zcache: outstanding_writeback_pages=%zd\n",
+				zcache_outstanding_writeback_pages);
+	pr_debug("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
+}
+#endif
diff --git a/drivers/staging/zcache/debug.h b/drivers/staging/zcache/debug.h
new file mode 100644
index 0000000..98dc491
--- /dev/null
+++ b/drivers/staging/zcache/debug.h
@@ -0,0 +1,187 @@
+#ifdef CONFIG_ZCACHE_DEBUG
+
+/* we try to keep these statistics SMP-consistent */
+static ssize_t zcache_obj_count;
+static atomic_t zcache_obj_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_obj_count_max;
+static inline void inc_zcache_obj_count(void)
+{
+	zcache_obj_count = atomic_inc_return(&zcache_obj_atomic);
+	if (zcache_obj_count > zcache_obj_count_max)
+		zcache_obj_count_max = zcache_obj_count;
+}
+static inline void dec_zcache_obj_count(void)
+{
+	zcache_obj_count = atomic_dec_return(&zcache_obj_atomic);
+	BUG_ON(zcache_obj_count < 0);
+};
+static ssize_t zcache_objnode_count;
+static atomic_t zcache_objnode_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_objnode_count_max;
+static inline void inc_zcache_objnode_count(void)
+{
+	zcache_objnode_count = atomic_inc_return(&zcache_objnode_atomic);
+	if (zcache_objnode_count > zcache_objnode_count_max)
+		zcache_objnode_count_max = zcache_objnode_count;
+};
+static inline void dec_zcache_objnode_count(void)
+{
+	zcache_objnode_count = atomic_dec_return(&zcache_objnode_atomic);
+	BUG_ON(zcache_objnode_count < 0);
+};
+static u64 zcache_eph_zbytes;
+static atomic_long_t zcache_eph_zbytes_atomic = ATOMIC_INIT(0);
+static u64 zcache_eph_zbytes_max;
+static inline void inc_zcache_eph_zbytes(unsigned clen)
+{
+	zcache_eph_zbytes = atomic_long_add_return(clen, &zcache_eph_zbytes_atomic);
+	if (zcache_eph_zbytes > zcache_eph_zbytes_max)
+		zcache_eph_zbytes_max = zcache_eph_zbytes;
+};
+static inline void dec_zcache_eph_zbytes(unsigned zsize)
+{
+	zcache_eph_zbytes = atomic_long_sub_return(zsize, &zcache_eph_zbytes_atomic);
+};
+extern  u64 zcache_pers_zbytes;
+static atomic_long_t zcache_pers_zbytes_atomic = ATOMIC_INIT(0);
+static u64 zcache_pers_zbytes_max;
+static inline void inc_zcache_pers_zbytes(unsigned clen)
+{
+	zcache_pers_zbytes = atomic_long_add_return(clen, &zcache_pers_zbytes_atomic);
+	if (zcache_pers_zbytes > zcache_pers_zbytes_max)
+		zcache_pers_zbytes_max = zcache_pers_zbytes;
+}
+static inline void dec_zcache_pers_zbytes(unsigned zsize)
+{
+	zcache_pers_zbytes = atomic_long_sub_return(zsize, &zcache_pers_zbytes_atomic);
+}
+extern ssize_t zcache_eph_pageframes;
+static atomic_t zcache_eph_pageframes_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_eph_pageframes_max;
+static inline void inc_zcache_eph_pageframes(void)
+{
+	zcache_eph_pageframes = atomic_inc_return(&zcache_eph_pageframes_atomic);
+	if (zcache_eph_pageframes > zcache_eph_pageframes_max)
+		zcache_eph_pageframes_max = zcache_eph_pageframes;
+};
+static inline void dec_zcache_eph_pageframes(void)
+{
+	zcache_eph_pageframes = atomic_dec_return(&zcache_eph_pageframes_atomic);
+};
+extern ssize_t zcache_pers_pageframes;
+static atomic_t zcache_pers_pageframes_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_pers_pageframes_max;
+static inline void inc_zcache_pers_pageframes(void)
+{
+	zcache_pers_pageframes = atomic_inc_return(&zcache_pers_pageframes_atomic);
+	if (zcache_pers_pageframes > zcache_pers_pageframes_max)
+		zcache_pers_pageframes_max = zcache_pers_pageframes;
+}
+static inline void dec_zcache_pers_pageframes(void)
+{
+	zcache_pers_pageframes = atomic_dec_return(&zcache_pers_pageframes_atomic);
+}
+static ssize_t zcache_pageframes_alloced;
+static atomic_t zcache_pageframes_alloced_atomic = ATOMIC_INIT(0);
+static inline void inc_zcache_pageframes_alloced(void)
+{
+	zcache_pageframes_alloced = atomic_inc_return(&zcache_pageframes_alloced_atomic);
+};
+static ssize_t zcache_pageframes_freed;
+static atomic_t zcache_pageframes_freed_atomic = ATOMIC_INIT(0);
+static inline void inc_zcache_pageframes_freed(void)
+{
+	zcache_pageframes_freed = atomic_inc_return(&zcache_pageframes_freed_atomic);
+}
+static ssize_t zcache_eph_zpages;
+static atomic_t zcache_eph_zpages_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_eph_zpages_max;
+static inline void inc_zcache_eph_zpages(void)
+{
+	zcache_eph_zpages = atomic_inc_return(&zcache_eph_zpages_atomic);
+	if (zcache_eph_zpages > zcache_eph_zpages_max)
+		zcache_eph_zpages_max = zcache_eph_zpages;
+}
+static inline void dec_zcache_eph_zpages(unsigned zpages)
+{
+	zcache_eph_zpages = atomic_sub_return(zpages, &zcache_eph_zpages_atomic);
+}
+extern ssize_t zcache_pers_zpages;
+static atomic_t zcache_pers_zpages_atomic = ATOMIC_INIT(0);
+static ssize_t zcache_pers_zpages_max;
+static inline void inc_zcache_pers_zpages(void)
+{
+	zcache_pers_zpages = atomic_inc_return(&zcache_pers_zpages_atomic);
+	if (zcache_pers_zpages > zcache_pers_zpages_max)
+		zcache_pers_zpages_max = zcache_pers_zpages;
+}
+static inline void dec_zcache_pers_zpages(unsigned zpages)
+{
+	zcache_pers_zpages = atomic_sub_return(zpages, &zcache_pers_zpages_atomic);
+}
+
+static inline unsigned long curr_pageframes_count(void)
+{
+	return zcache_pageframes_alloced -
+		atomic_read(&zcache_pageframes_freed_atomic) -
+		atomic_read(&zcache_eph_pageframes_atomic) -
+		atomic_read(&zcache_pers_pageframes_atomic);
+};
+/* but for the rest of these, counting races are ok */
+extern ssize_t zcache_flush_total;
+extern ssize_t zcache_flush_found;
+extern ssize_t zcache_flobj_total;
+extern ssize_t zcache_flobj_found;
+extern ssize_t zcache_failed_eph_puts;
+extern ssize_t zcache_failed_pers_puts;
+extern ssize_t zcache_failed_getfreepages;
+extern ssize_t zcache_failed_alloc;
+extern ssize_t zcache_put_to_flush;
+extern ssize_t zcache_compress_poor;
+extern ssize_t zcache_mean_compress_poor;
+extern ssize_t zcache_eph_ate_tail;
+extern ssize_t zcache_eph_ate_tail_failed;
+extern ssize_t zcache_pers_ate_eph;
+extern ssize_t zcache_pers_ate_eph_failed;
+extern ssize_t zcache_evicted_eph_zpages;
+extern ssize_t zcache_evicted_eph_pageframes;
+extern ssize_t zcache_last_active_file_pageframes;
+extern ssize_t zcache_last_inactive_file_pageframes;
+extern ssize_t zcache_last_active_anon_pageframes;
+extern ssize_t zcache_last_inactive_anon_pageframes;
+extern ssize_t zcache_eph_nonactive_puts_ignored;
+extern ssize_t zcache_pers_nonactive_puts_ignored;
+#ifdef CONFIG_ZCACHE_WRITEBACK
+extern ssize_t zcache_writtenback_pages;
+extern ssize_t zcache_outstanding_writeback_pages;
+#endif
+
+int zcache_debugfs_init(void);
+#else
+static inline void inc_zcache_obj_count(void) { };
+static inline void dec_zcache_obj_count(void) { };
+static inline void inc_zcache_objnode_count(void) { };
+static inline void dec_zcache_objnode_count(void) { };
+static inline void inc_zcache_eph_zbytes(unsigned clen) { };
+static inline void dec_zcache_eph_zbytes(unsigned zsize) { };
+static inline void inc_zcache_pers_zbytes(unsigned clen) { };
+static inline void dec_zcache_pers_zbytes(unsigned zsize) { };
+static inline void inc_zcache_eph_pageframes(void) { };
+static inline void dec_zcache_eph_pageframes(void) { };
+static inline void inc_zcache_pers_pageframes(void) { };
+static inline void dec_zcache_pers_pageframes(void) { };
+static inline void inc_zcache_pageframes_alloced(void) { };
+static inline void inc_zcache_pageframes_freed(void) { };
+static inline void inc_zcache_eph_zpages(void) { };
+static inline void dec_zcache_eph_zpages(unsigned zpages) { };
+static inline void inc_zcache_pers_zpages(void) { };
+static inline void dec_zcache_pers_zpages(unsigned zpages) { };
+static inline unsigned long curr_pageframes_count(void)
+{
+	return 0;
+};
+static inline int zcache_debugfs_init(void)
+{
+	return 0;
+};
+#endif
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index d4bf4a2..9d6cf96 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -33,6 +33,7 @@
 #include "zcache.h"
 #include "zbud.h"
 #include "ramster.h"
+#include "debug.h"
 #ifdef CONFIG_RAMSTER
 static bool ramster_enabled __read_mostly;
 #else
@@ -134,135 +135,13 @@ static struct kmem_cache *zcache_obj_cache;
 
 static DEFINE_PER_CPU(struct zcache_preload, zcache_preloads) = { 0, };
 
-/* we try to keep these statistics SMP-consistent */
-static ssize_t zcache_obj_count;
-static atomic_t zcache_obj_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_obj_count_max;
-static inline void inc_zcache_obj_count(void)
-{
-	zcache_obj_count = atomic_inc_return(&zcache_obj_atomic);
-	if (zcache_obj_count > zcache_obj_count_max)
-		zcache_obj_count_max = zcache_obj_count;
-}
-static ssize_t zcache_objnode_count;
-static inline void dec_zcache_obj_count(void)
-{
-	zcache_obj_count = atomic_dec_return(&zcache_obj_atomic);
-	BUG_ON(zcache_obj_count < 0);
-};
-static atomic_t zcache_objnode_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_objnode_count_max;
-static inline void inc_zcache_objnode_count(void)
-{
-	zcache_objnode_count = atomic_inc_return(&zcache_objnode_atomic);
-	if (zcache_objnode_count > zcache_objnode_count_max)
-		zcache_objnode_count_max = zcache_objnode_count;
-};
-static inline void dec_zcache_objnode_count(void)
-{
-	zcache_objnode_count = atomic_dec_return(&zcache_objnode_atomic);
-	BUG_ON(zcache_objnode_count < 0);
-};
-static u64 zcache_eph_zbytes;
-static atomic_long_t zcache_eph_zbytes_atomic = ATOMIC_INIT(0);
-static u64 zcache_eph_zbytes_max;
-static inline void inc_zcache_eph_zbytes(unsigned clen)
-{
-	zcache_eph_zbytes = atomic_long_add_return(clen, &zcache_eph_zbytes_atomic);
-	if (zcache_eph_zbytes > zcache_eph_zbytes_max)
-		zcache_eph_zbytes_max = zcache_eph_zbytes;
-};
-static inline void dec_zcache_eph_zbytes(unsigned zsize)
-{
-	zcache_eph_zbytes = atomic_long_sub_return(zsize, &zcache_eph_zbytes_atomic);
-};
-static u64 zcache_pers_zbytes;
-static atomic_long_t zcache_pers_zbytes_atomic = ATOMIC_INIT(0);
-static u64 zcache_pers_zbytes_max;
-static inline void inc_zcache_pers_zbytes(unsigned clen)
-{
-	zcache_pers_zbytes = atomic_long_add_return(clen, &zcache_pers_zbytes_atomic);
-	if (zcache_pers_zbytes > zcache_pers_zbytes_max)
-		zcache_pers_zbytes_max = zcache_pers_zbytes;
-}
-static ssize_t zcache_eph_pageframes;
-static inline void dec_zcache_pers_zbytes(unsigned zsize)
-{
-	zcache_pers_zbytes = atomic_long_sub_return(zsize, &zcache_pers_zbytes_atomic);
-}
-static atomic_t zcache_eph_pageframes_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_eph_pageframes_max;
-static inline void inc_zcache_eph_pageframes(void)
-{
-	zcache_eph_pageframes = atomic_inc_return(&zcache_eph_pageframes_atomic);
-	if (zcache_eph_pageframes > zcache_eph_pageframes_max)
-		zcache_eph_pageframes_max = zcache_eph_pageframes;
-};
-static ssize_t zcache_pers_pageframes;
-static inline void dec_zcache_eph_pageframes(void)
-{
-	zcache_eph_pageframes = atomic_dec_return(&zcache_eph_pageframes_atomic);
-};
-static atomic_t zcache_pers_pageframes_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_pers_pageframes_max;
-static inline void inc_zcache_pers_pageframes(void)
-{
-	zcache_pers_pageframes = atomic_inc_return(&zcache_pers_pageframes_atomic);
-	if (zcache_pers_pageframes > zcache_pers_pageframes_max)
-		zcache_pers_pageframes_max = zcache_pers_pageframes;
-}
-static ssize_t zcache_pageframes_alloced;
-static inline void dec_zcache_pers_pageframes(void)
-{
-	zcache_pers_pageframes = atomic_dec_return(&zcache_pers_pageframes_atomic);
-}
-static atomic_t zcache_pageframes_alloced_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_pageframes_freed;
-static atomic_t zcache_pageframes_freed_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_eph_zpages;
-static inline void inc_zcache_pageframes_alloced(void)
-{
-	zcache_pageframes_alloced = atomic_inc_return(&zcache_pageframes_alloced_atomic);
-};
-static inline void inc_zcache_pageframes_freed(void)
-{
-	zcache_pageframes_freed = atomic_inc_return(&zcache_pageframes_freed_atomic);
-}
-static ssize_t zcache_eph_zpages;
-static atomic_t zcache_eph_zpages_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_eph_zpages_max;
-static inline void inc_zcache_eph_zpages(void)
-{
-	zcache_eph_zpages = atomic_inc_return(&zcache_eph_zpages_atomic);
-	if (zcache_eph_zpages > zcache_eph_zpages_max)
-		zcache_eph_zpages_max = zcache_eph_zpages;
-}
-static ssize_t zcache_pers_zpages;
-static inline void dec_zcache_eph_zpages(unsigned zpages)
-{
-	zcache_eph_zpages = atomic_sub_return(zpages, &zcache_eph_zpages_atomic);
-}
-static atomic_t zcache_pers_zpages_atomic = ATOMIC_INIT(0);
-static ssize_t zcache_pers_zpages_max;
-static inline void inc_zcache_pers_zpages(void)
-{
-	zcache_pers_zpages = atomic_inc_return(&zcache_pers_zpages_atomic);
-	if (zcache_pers_zpages > zcache_pers_zpages_max)
-		zcache_pers_zpages_max = zcache_pers_zpages;
-}
-static inline void dec_zcache_pers_zpages(unsigned zpages)
-{
-	zcache_pers_zpages = atomic_sub_return(zpages, &zcache_pers_zpages_atomic);
-}
+/* Used by debug.c */
+ssize_t zcache_pers_zpages;
+u64 zcache_pers_zbytes;
+ssize_t zcache_eph_pageframes;
+ssize_t zcache_pers_pageframes;
 
-static inline unsigned long curr_pageframes_count(void)
-{
-	return zcache_pageframes_alloced -
-		atomic_read(&zcache_pageframes_freed_atomic) -
-		atomic_read(&zcache_eph_pageframes_atomic) -
-		atomic_read(&zcache_pers_pageframes_atomic);
-};
-/* but for the rest of these, counting races are ok */
+/* Used by this code. */
 static ssize_t zcache_flush_total;
 static ssize_t zcache_flush_found;
 static ssize_t zcache_flobj_total;
@@ -286,138 +165,10 @@ static ssize_t zcache_last_active_anon_pageframes;
 static ssize_t zcache_last_inactive_anon_pageframes;
 static ssize_t zcache_eph_nonactive_puts_ignored;
 static ssize_t zcache_pers_nonactive_puts_ignored;
+#ifdef CONFIG_ZCACHE_WRITEBACK
 static ssize_t zcache_writtenback_pages;
 static ssize_t zcache_outstanding_writeback_pages;
-
-#ifdef CONFIG_DEBUG_FS
-#include <linux/debugfs.h>
-#define	zdfs	debugfs_create_size_t
-#define	zdfs64	debugfs_create_u64
-static int zcache_debugfs_init(void)
-{
-	struct dentry *root = debugfs_create_dir("zcache", NULL);
-	if (root == NULL)
-		return -ENXIO;
-
-	zdfs("obj_count", S_IRUGO, root, &zcache_obj_count);
-	zdfs("obj_count_max", S_IRUGO, root, &zcache_obj_count_max);
-	zdfs("objnode_count", S_IRUGO, root, &zcache_objnode_count);
-	zdfs("objnode_count_max", S_IRUGO, root, &zcache_objnode_count_max);
-	zdfs("flush_total", S_IRUGO, root, &zcache_flush_total);
-	zdfs("flush_found", S_IRUGO, root, &zcache_flush_found);
-	zdfs("flobj_total", S_IRUGO, root, &zcache_flobj_total);
-	zdfs("flobj_found", S_IRUGO, root, &zcache_flobj_found);
-	zdfs("failed_eph_puts", S_IRUGO, root, &zcache_failed_eph_puts);
-	zdfs("failed_pers_puts", S_IRUGO, root, &zcache_failed_pers_puts);
-	zdfs("failed_get_free_pages", S_IRUGO, root,
-				&zcache_failed_getfreepages);
-	zdfs("failed_alloc", S_IRUGO, root, &zcache_failed_alloc);
-	zdfs("put_to_flush", S_IRUGO, root, &zcache_put_to_flush);
-	zdfs("compress_poor", S_IRUGO, root, &zcache_compress_poor);
-	zdfs("mean_compress_poor", S_IRUGO, root, &zcache_mean_compress_poor);
-	zdfs("eph_ate_tail", S_IRUGO, root, &zcache_eph_ate_tail);
-	zdfs("eph_ate_tail_failed", S_IRUGO, root, &zcache_eph_ate_tail_failed);
-	zdfs("pers_ate_eph", S_IRUGO, root, &zcache_pers_ate_eph);
-	zdfs("pers_ate_eph_failed", S_IRUGO, root, &zcache_pers_ate_eph_failed);
-	zdfs("evicted_eph_zpages", S_IRUGO, root, &zcache_evicted_eph_zpages);
-	zdfs("evicted_eph_pageframes", S_IRUGO, root,
-				&zcache_evicted_eph_pageframes);
-	zdfs("eph_pageframes", S_IRUGO, root, &zcache_eph_pageframes);
-	zdfs("eph_pageframes_max", S_IRUGO, root, &zcache_eph_pageframes_max);
-	zdfs("pers_pageframes", S_IRUGO, root, &zcache_pers_pageframes);
-	zdfs("pers_pageframes_max", S_IRUGO, root, &zcache_pers_pageframes_max);
-	zdfs("eph_zpages", S_IRUGO, root, &zcache_eph_zpages);
-	zdfs("eph_zpages_max", S_IRUGO, root, &zcache_eph_zpages_max);
-	zdfs("pers_zpages", S_IRUGO, root, &zcache_pers_zpages);
-	zdfs("pers_zpages_max", S_IRUGO, root, &zcache_pers_zpages_max);
-	zdfs("last_active_file_pageframes", S_IRUGO, root,
-				&zcache_last_active_file_pageframes);
-	zdfs("last_inactive_file_pageframes", S_IRUGO, root,
-				&zcache_last_inactive_file_pageframes);
-	zdfs("last_active_anon_pageframes", S_IRUGO, root,
-				&zcache_last_active_anon_pageframes);
-	zdfs("last_inactive_anon_pageframes", S_IRUGO, root,
-				&zcache_last_inactive_anon_pageframes);
-	zdfs("eph_nonactive_puts_ignored", S_IRUGO, root,
-				&zcache_eph_nonactive_puts_ignored);
-	zdfs("pers_nonactive_puts_ignored", S_IRUGO, root,
-				&zcache_pers_nonactive_puts_ignored);
-	zdfs64("eph_zbytes", S_IRUGO, root, &zcache_eph_zbytes);
-	zdfs64("eph_zbytes_max", S_IRUGO, root, &zcache_eph_zbytes_max);
-	zdfs64("pers_zbytes", S_IRUGO, root, &zcache_pers_zbytes);
-	zdfs64("pers_zbytes_max", S_IRUGO, root, &zcache_pers_zbytes_max);
-	zdfs("outstanding_writeback_pages", S_IRUGO, root,
-				&zcache_outstanding_writeback_pages);
-	zdfs("writtenback_pages", S_IRUGO, root, &zcache_writtenback_pages);
-	return 0;
-}
-#undef	zdebugfs
-#undef	zdfs64
 #endif
-
-/* developers can call this in case of ooms, e.g. to find memory leaks */
-void zcache_dump(void)
-{
-	pr_debug("zcache: obj_count=%zd\n", zcache_obj_count);
-	pr_debug("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
-	pr_debug("zcache: objnode_count=%zd\n", zcache_objnode_count);
-	pr_debug("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
-	pr_debug("zcache: flush_total=%zd\n", zcache_flush_total);
-	pr_debug("zcache: flush_found=%zd\n", zcache_flush_found);
-	pr_debug("zcache: flobj_total=%zd\n", zcache_flobj_total);
-	pr_debug("zcache: flobj_found=%zd\n", zcache_flobj_found);
-	pr_debug("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
-	pr_debug("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
-	pr_debug("zcache: failed_get_free_pages=%zd\n",
-				zcache_failed_getfreepages);
-	pr_debug("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
-	pr_debug("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
-	pr_debug("zcache: compress_poor=%zd\n", zcache_compress_poor);
-	pr_debug("zcache: mean_compress_poor=%zd\n",
-				zcache_mean_compress_poor);
-	pr_debug("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
-	pr_debug("zcache: eph_ate_tail_failed=%zd\n",
-				zcache_eph_ate_tail_failed);
-	pr_debug("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
-	pr_debug("zcache: pers_ate_eph_failed=%zd\n",
-				zcache_pers_ate_eph_failed);
-	pr_debug("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
-	pr_debug("zcache: evicted_eph_pageframes=%zd\n",
-				zcache_evicted_eph_pageframes);
-	pr_debug("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
-	pr_debug("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
-	pr_debug("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
-	pr_debug("zcache: pers_pageframes_max=%zd\n",
-				zcache_pers_pageframes_max);
-	pr_debug("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
-	pr_debug("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
-	pr_debug("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
-	pr_debug("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
-	pr_debug("zcache: last_active_file_pageframes=%zd\n",
-				zcache_last_active_file_pageframes);
-	pr_debug("zcache: last_inactive_file_pageframes=%zd\n",
-				zcache_last_inactive_file_pageframes);
-	pr_debug("zcache: last_active_anon_pageframes=%zd\n",
-				zcache_last_active_anon_pageframes);
-	pr_debug("zcache: last_inactive_anon_pageframes=%zd\n",
-				zcache_last_inactive_anon_pageframes);
-	pr_debug("zcache: eph_nonactive_puts_ignored=%zd\n",
-				zcache_eph_nonactive_puts_ignored);
-	pr_debug("zcache: pers_nonactive_puts_ignored=%zd\n",
-				zcache_pers_nonactive_puts_ignored);
-	pr_debug("zcache: eph_zbytes=%llu\n",
-				zcache_eph_zbytes);
-	pr_debug("zcache: eph_zbytes_max=%llu\n",
-				zcache_eph_zbytes_max);
-	pr_debug("zcache: pers_zbytes=%llu\n",
-				zcache_pers_zbytes);
-	pr_debug("zcache: pers_zbytes_max=%llu\n",
-				zcache_pers_zbytes_max);
-	pr_debug("zcache: outstanding_writeback_pages=%zd\n",
-				zcache_outstanding_writeback_pages);
-	pr_debug("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
-}
-
 /*
  * zcache core code starts here
  */
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/16] zcache/debug: Use an array to initialize/use debugfs attributes.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (6 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 07/16] zcache: Move debugfs code out of zcache-main.c file Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:04 ` [PATCH 09/16] zcache: Move the last of the debugfs counters out Konrad Rzeszutek Wilk
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

It makes it neater and also allows us to piggyback on that
in the zcache_dump function.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/debug.c | 163 +++++++++++++----------------------------
 1 file changed, 51 insertions(+), 112 deletions(-)

diff --git a/drivers/staging/zcache/debug.c b/drivers/staging/zcache/debug.c
index 622d5f3..cf19adc 100644
--- a/drivers/staging/zcache/debug.c
+++ b/drivers/staging/zcache/debug.c
@@ -3,130 +3,69 @@
 
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
-#define	zdfs	debugfs_create_size_t
-#define	zdfs64	debugfs_create_u64
+
+#define ATTR(x)  { .name = #x, .val = &zcache_##x, }
+static struct debug_entry {
+	const char *name;
+	ssize_t *val;
+} attrs[] = {
+	ATTR(obj_count), ATTR(obj_count_max),
+	ATTR(objnode_count), ATTR(objnode_count_max),
+	ATTR(flush_total), ATTR(flush_found),
+	ATTR(flobj_total), ATTR(flobj_found),
+	ATTR(failed_eph_puts), ATTR(failed_pers_puts),
+	ATTR(failed_getfreepages), ATTR(failed_alloc),
+	ATTR(put_to_flush),
+	ATTR(compress_poor), ATTR(mean_compress_poor),
+	ATTR(eph_ate_tail), ATTR(eph_ate_tail_failed),
+	ATTR(pers_ate_eph), ATTR(pers_ate_eph_failed),
+	ATTR(evicted_eph_zpages), ATTR(evicted_eph_pageframes),
+	ATTR(eph_pageframes), ATTR(eph_pageframes_max),
+	ATTR(eph_zpages), ATTR(eph_zpages_max),
+	ATTR(pers_zpages), ATTR(pers_zpages_max),
+	ATTR(last_active_file_pageframes),
+	ATTR(last_inactive_file_pageframes),
+	ATTR(last_active_anon_pageframes),
+	ATTR(last_inactive_anon_pageframes),
+	ATTR(eph_nonactive_puts_ignored),
+	ATTR(pers_nonactive_puts_ignored),
+#ifdef CONFIG_ZCACHE_WRITEBACK
+	ATTR(zcache_outstanding_writeback_pages),
+	ATTR(zcache_writtenback_pages),
+#endif
+};
+#undef ATTR
 int zcache_debugfs_init(void)
 {
+	unsigned int i;
 	struct dentry *root = debugfs_create_dir("zcache", NULL);
 	if (root == NULL)
 		return -ENXIO;
 
-	zdfs("obj_count", S_IRUGO, root, &zcache_obj_count);
-	zdfs("obj_count_max", S_IRUGO, root, &zcache_obj_count_max);
-	zdfs("objnode_count", S_IRUGO, root, &zcache_objnode_count);
-	zdfs("objnode_count_max", S_IRUGO, root, &zcache_objnode_count_max);
-	zdfs("flush_total", S_IRUGO, root, &zcache_flush_total);
-	zdfs("flush_found", S_IRUGO, root, &zcache_flush_found);
-	zdfs("flobj_total", S_IRUGO, root, &zcache_flobj_total);
-	zdfs("flobj_found", S_IRUGO, root, &zcache_flobj_found);
-	zdfs("failed_eph_puts", S_IRUGO, root, &zcache_failed_eph_puts);
-	zdfs("failed_pers_puts", S_IRUGO, root, &zcache_failed_pers_puts);
-	zdfs("failed_get_free_pages", S_IRUGO, root,
-				&zcache_failed_getfreepages);
-	zdfs("failed_alloc", S_IRUGO, root, &zcache_failed_alloc);
-	zdfs("put_to_flush", S_IRUGO, root, &zcache_put_to_flush);
-	zdfs("compress_poor", S_IRUGO, root, &zcache_compress_poor);
-	zdfs("mean_compress_poor", S_IRUGO, root, &zcache_mean_compress_poor);
-	zdfs("eph_ate_tail", S_IRUGO, root, &zcache_eph_ate_tail);
-	zdfs("eph_ate_tail_failed", S_IRUGO, root, &zcache_eph_ate_tail_failed);
-	zdfs("pers_ate_eph", S_IRUGO, root, &zcache_pers_ate_eph);
-	zdfs("pers_ate_eph_failed", S_IRUGO, root, &zcache_pers_ate_eph_failed);
-	zdfs("evicted_eph_zpages", S_IRUGO, root, &zcache_evicted_eph_zpages);
-	zdfs("evicted_eph_pageframes", S_IRUGO, root,
-				&zcache_evicted_eph_pageframes);
-	zdfs("eph_pageframes", S_IRUGO, root, &zcache_eph_pageframes);
-	zdfs("eph_pageframes_max", S_IRUGO, root, &zcache_eph_pageframes_max);
-	zdfs("pers_pageframes", S_IRUGO, root, &zcache_pers_pageframes);
-	zdfs("pers_pageframes_max", S_IRUGO, root, &zcache_pers_pageframes_max);
-	zdfs("eph_zpages", S_IRUGO, root, &zcache_eph_zpages);
-	zdfs("eph_zpages_max", S_IRUGO, root, &zcache_eph_zpages_max);
-	zdfs("pers_zpages", S_IRUGO, root, &zcache_pers_zpages);
-	zdfs("pers_zpages_max", S_IRUGO, root, &zcache_pers_zpages_max);
-	zdfs("last_active_file_pageframes", S_IRUGO, root,
-				&zcache_last_active_file_pageframes);
-	zdfs("last_inactive_file_pageframes", S_IRUGO, root,
-				&zcache_last_inactive_file_pageframes);
-	zdfs("last_active_anon_pageframes", S_IRUGO, root,
-				&zcache_last_active_anon_pageframes);
-	zdfs("last_inactive_anon_pageframes", S_IRUGO, root,
-				&zcache_last_inactive_anon_pageframes);
-	zdfs("eph_nonactive_puts_ignored", S_IRUGO, root,
-				&zcache_eph_nonactive_puts_ignored);
-	zdfs("pers_nonactive_puts_ignored", S_IRUGO, root,
-				&zcache_pers_nonactive_puts_ignored);
-	zdfs64("eph_zbytes", S_IRUGO, root, &zcache_eph_zbytes);
-	zdfs64("eph_zbytes_max", S_IRUGO, root, &zcache_eph_zbytes_max);
-	zdfs64("pers_zbytes", S_IRUGO, root, &zcache_pers_zbytes);
-	zdfs64("pers_zbytes_max", S_IRUGO, root, &zcache_pers_zbytes_max);
-	zdfs("outstanding_writeback_pages", S_IRUGO, root,
-				&zcache_outstanding_writeback_pages);
-	zdfs("writtenback_pages", S_IRUGO, root, &zcache_writtenback_pages);
+	for (i = 0; i < ARRAY_SIZE(attrs); i++)
+		if (!debugfs_create_size_t(attrs[i].name, S_IRUGO, root, attrs[i].val))
+			goto out;
+
+	debugfs_create_u64("eph_zbytes", S_IRUGO, root, &zcache_eph_zbytes);
+	debugfs_create_u64("eph_zbytes_max", S_IRUGO, root, &zcache_eph_zbytes_max);
+	debugfs_create_u64("pers_zbytes", S_IRUGO, root, &zcache_pers_zbytes);
+	debugfs_create_u64("pers_zbytes_max", S_IRUGO, root, &zcache_pers_zbytes_max);
 
 	return 0;
+out:
+	return -ENODEV;
 }
-#undef	zdebugfs
-#undef	zdfs64
 
 /* developers can call this in case of ooms, e.g. to find memory leaks */
 void zcache_dump(void)
 {
-	pr_debug("zcache: obj_count=%zd\n", zcache_obj_count);
-	pr_debug("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
-	pr_debug("zcache: objnode_count=%zd\n", zcache_objnode_count);
-	pr_debug("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
-	pr_debug("zcache: flush_total=%zd\n", zcache_flush_total);
-	pr_debug("zcache: flush_found=%zd\n", zcache_flush_found);
-	pr_debug("zcache: flobj_total=%zd\n", zcache_flobj_total);
-	pr_debug("zcache: flobj_found=%zd\n", zcache_flobj_found);
-	pr_debug("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
-	pr_debug("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
-	pr_debug("zcache: failed_get_free_pages=%zd\n",
-				zcache_failed_getfreepages);
-	pr_debug("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
-	pr_debug("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
-	pr_debug("zcache: compress_poor=%zd\n", zcache_compress_poor);
-	pr_debug("zcache: mean_compress_poor=%zd\n",
-				zcache_mean_compress_poor);
-	pr_debug("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
-	pr_debug("zcache: eph_ate_tail_failed=%zd\n",
-				zcache_eph_ate_tail_failed);
-	pr_debug("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
-	pr_debug("zcache: pers_ate_eph_failed=%zd\n",
-				zcache_pers_ate_eph_failed);
-	pr_debug("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
-	pr_debug("zcache: evicted_eph_pageframes=%zd\n",
-				zcache_evicted_eph_pageframes);
-	pr_debug("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
-	pr_debug("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
-	pr_debug("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
-	pr_debug("zcache: pers_pageframes_max=%zd\n",
-				zcache_pers_pageframes_max);
-	pr_debug("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
-	pr_debug("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
-	pr_debug("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
-	pr_debug("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
-	pr_debug("zcache: last_active_file_pageframes=%zd\n",
-				zcache_last_active_file_pageframes);
-	pr_debug("zcache: last_inactive_file_pageframes=%zd\n",
-				zcache_last_inactive_file_pageframes);
-	pr_debug("zcache: last_active_anon_pageframes=%zd\n",
-				zcache_last_active_anon_pageframes);
-	pr_debug("zcache: last_inactive_anon_pageframes=%zd\n",
-				zcache_last_inactive_anon_pageframes);
-	pr_debug("zcache: eph_nonactive_puts_ignored=%zd\n",
-				zcache_eph_nonactive_puts_ignored);
-	pr_debug("zcache: pers_nonactive_puts_ignored=%zd\n",
-				zcache_pers_nonactive_puts_ignored);
-	pr_debug("zcache: eph_zbytes=%llu\n",
-				zcache_eph_zbytes);
-	pr_debug("zcache: eph_zbytes_max=%llu\n",
-				zcache_eph_zbytes_max);
-	pr_debug("zcache: pers_zbytes=%llu\n",
-				zcache_pers_zbytes);
-	pr_debug("zcache: pers_zbytes_max=%llu\n",
-				zcache_pers_zbytes_max);
-	pr_debug("zcache: outstanding_writeback_pages=%zd\n",
-				zcache_outstanding_writeback_pages);
-	pr_debug("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(attrs); i++)
+		pr_debug("zcache: %s=%zu\n", attrs[i].name, *attrs[i].val);
+
+	pr_debug("zcache: eph_zbytes=%llu\n", (unsigned long long)zcache_eph_zbytes);
+	pr_debug("zcache: eph_zbytes_max=%llu\n", (unsigned long long)zcache_eph_zbytes_max);
+	pr_debug("zcache: pers_zbytes=%llu\n", (unsigned long long)zcache_pers_zbytes);
+	pr_debug("zcache: pers_zbytes_max=%llu\n", (unsigned long long)zcache_pers_zbytes_max);
 }
 #endif
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/16] zcache: Move the last of the debugfs counters out
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (7 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 08/16] zcache/debug: Use an array to initialize/use debugfs attributes Konrad Rzeszutek Wilk
@ 2013-02-14  3:04 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 10/16] zcache: Module license is defined twice Konrad Rzeszutek Wilk
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:04 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

We now have in zcache-main only the counters that are
are not debugfs related.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/debug.h       | 80 +++++++++++++++++++++++++++---------
 drivers/staging/zcache/zcache-main.c | 75 +++++++++++++--------------------
 2 files changed, 89 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/zcache/debug.h b/drivers/staging/zcache/debug.h
index 98dc491..eef67db 100644
--- a/drivers/staging/zcache/debug.h
+++ b/drivers/staging/zcache/debug.h
@@ -128,34 +128,56 @@ static inline unsigned long curr_pageframes_count(void)
 		atomic_read(&zcache_pers_pageframes_atomic);
 };
 /* but for the rest of these, counting races are ok */
-extern ssize_t zcache_flush_total;
-extern ssize_t zcache_flush_found;
-extern ssize_t zcache_flobj_total;
-extern ssize_t zcache_flobj_found;
-extern ssize_t zcache_failed_eph_puts;
-extern ssize_t zcache_failed_pers_puts;
-extern ssize_t zcache_failed_getfreepages;
-extern ssize_t zcache_failed_alloc;
-extern ssize_t zcache_put_to_flush;
-extern ssize_t zcache_compress_poor;
-extern ssize_t zcache_mean_compress_poor;
-extern ssize_t zcache_eph_ate_tail;
-extern ssize_t zcache_eph_ate_tail_failed;
-extern ssize_t zcache_pers_ate_eph;
-extern ssize_t zcache_pers_ate_eph_failed;
-extern ssize_t zcache_evicted_eph_zpages;
-extern ssize_t zcache_evicted_eph_pageframes;
+static ssize_t zcache_flush_total;
+static ssize_t zcache_flush_found;
+static ssize_t zcache_flobj_total;
+static ssize_t zcache_flobj_found;
+static ssize_t zcache_failed_eph_puts;
+static ssize_t zcache_failed_pers_puts;
+static ssize_t zcache_failed_getfreepages;
+static ssize_t zcache_failed_alloc;
+static ssize_t zcache_put_to_flush;
+static ssize_t zcache_compress_poor;
+static ssize_t zcache_mean_compress_poor;
+static ssize_t zcache_eph_ate_tail;
+static ssize_t zcache_eph_ate_tail_failed;
+static ssize_t zcache_pers_ate_eph;
+static ssize_t zcache_pers_ate_eph_failed;
+static ssize_t zcache_evicted_eph_zpages;
+static ssize_t zcache_evicted_eph_pageframes;
+
 extern ssize_t zcache_last_active_file_pageframes;
 extern ssize_t zcache_last_inactive_file_pageframes;
 extern ssize_t zcache_last_active_anon_pageframes;
 extern ssize_t zcache_last_inactive_anon_pageframes;
-extern ssize_t zcache_eph_nonactive_puts_ignored;
-extern ssize_t zcache_pers_nonactive_puts_ignored;
+static ssize_t zcache_eph_nonactive_puts_ignored;
+static ssize_t zcache_pers_nonactive_puts_ignored;
 #ifdef CONFIG_ZCACHE_WRITEBACK
 extern ssize_t zcache_writtenback_pages;
 extern ssize_t zcache_outstanding_writeback_pages;
 #endif
 
+static inline void inc_zcache_flush_total(void) { zcache_flush_total ++; };
+static inline void inc_zcache_flush_found(void) { zcache_flush_found ++; };
+static inline void inc_zcache_flobj_total(void) { zcache_flobj_total ++; };
+static inline void inc_zcache_flobj_found(void) { zcache_flobj_found ++; };
+static inline void inc_zcache_failed_eph_puts(void) { zcache_failed_eph_puts ++; };
+static inline void inc_zcache_failed_pers_puts(void) { zcache_failed_pers_puts ++; };
+static inline void inc_zcache_failed_getfreepages(void) { zcache_failed_getfreepages ++; };
+static inline void inc_zcache_failed_alloc(void) { zcache_failed_alloc ++; };
+static inline void inc_zcache_put_to_flush(void) { zcache_put_to_flush ++; };
+static inline void inc_zcache_compress_poor(void) { zcache_compress_poor ++; };
+static inline void inc_zcache_mean_compress_poor(void) { zcache_mean_compress_poor ++; };
+static inline void inc_zcache_eph_ate_tail(void) { zcache_eph_ate_tail ++; };
+static inline void inc_zcache_eph_ate_tail_failed(void) { zcache_eph_ate_tail_failed ++; };
+static inline void inc_zcache_pers_ate_eph(void) { zcache_pers_ate_eph ++; };
+static inline void inc_zcache_pers_ate_eph_failed(void) { zcache_pers_ate_eph_failed ++; };
+static inline void inc_zcache_evicted_eph_zpages(unsigned zpages) { zcache_evicted_eph_zpages += zpages; };
+static inline void inc_zcache_evicted_eph_pageframes(void) { zcache_evicted_eph_pageframes ++; };
+
+static inline void inc_zcache_eph_nonactive_puts_ignored(void) { zcache_eph_nonactive_puts_ignored ++; };
+static inline void inc_zcache_pers_nonactive_puts_ignored(void) { zcache_pers_nonactive_puts_ignored ++; };
+
 int zcache_debugfs_init(void);
 #else
 static inline void inc_zcache_obj_count(void) { };
@@ -184,4 +206,24 @@ static inline int zcache_debugfs_init(void)
 {
 	return 0;
 };
+static inline void inc_zcache_flush_total(void) { };
+static inline void inc_zcache_flush_found(void) { };
+static inline void inc_zcache_flobj_total(void) { };
+static inline void inc_zcache_flobj_found(void) { };
+static inline void inc_zcache_failed_eph_puts(void) { };
+static inline void inc_zcache_failed_pers_puts(void) { };
+static inline void inc_zcache_failed_getfreepages(void) { };
+static inline void inc_zcache_failed_alloc(void) { };
+static inline void inc_zcache_put_to_flush(void) { };
+static inline void inc_zcache_compress_poor(void) { };
+static inline void inc_zcache_mean_compress_poor(void) { };
+static inline void inc_zcache_eph_ate_tail(void) { };
+static inline void inc_zcache_eph_ate_tail_failed(void) { };
+static inline void inc_zcache_pers_ate_eph(void) { };
+static inline void inc_zcache_pers_ate_eph_failed(void) { };
+static inline void inc_zcache_evicted_eph_zpages(unsigned zpages) { };
+static inline void inc_zcache_evicted_eph_pageframes(void) { };
+
+static inline void inc_zcache_eph_nonactive_puts_ignored(void) { };
+static inline void inc_zcache_pers_nonactive_puts_ignored(void) { };
 #endif
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 9d6cf96..059c0f2 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -142,32 +142,13 @@ ssize_t zcache_eph_pageframes;
 ssize_t zcache_pers_pageframes;
 
 /* Used by this code. */
-static ssize_t zcache_flush_total;
-static ssize_t zcache_flush_found;
-static ssize_t zcache_flobj_total;
-static ssize_t zcache_flobj_found;
-static ssize_t zcache_failed_eph_puts;
-static ssize_t zcache_failed_pers_puts;
-static ssize_t zcache_failed_getfreepages;
-static ssize_t zcache_failed_alloc;
-static ssize_t zcache_put_to_flush;
-static ssize_t zcache_compress_poor;
-static ssize_t zcache_mean_compress_poor;
-static ssize_t zcache_eph_ate_tail;
-static ssize_t zcache_eph_ate_tail_failed;
-static ssize_t zcache_pers_ate_eph;
-static ssize_t zcache_pers_ate_eph_failed;
-static ssize_t zcache_evicted_eph_zpages;
-static ssize_t zcache_evicted_eph_pageframes;
-static ssize_t zcache_last_active_file_pageframes;
-static ssize_t zcache_last_inactive_file_pageframes;
-static ssize_t zcache_last_active_anon_pageframes;
-static ssize_t zcache_last_inactive_anon_pageframes;
-static ssize_t zcache_eph_nonactive_puts_ignored;
-static ssize_t zcache_pers_nonactive_puts_ignored;
+ssize_t zcache_last_active_file_pageframes;
+ssize_t zcache_last_inactive_file_pageframes;
+ssize_t zcache_last_active_anon_pageframes;
+ssize_t zcache_last_inactive_anon_pageframes;
 #ifdef CONFIG_ZCACHE_WRITEBACK
-static ssize_t zcache_writtenback_pages;
-static ssize_t zcache_outstanding_writeback_pages;
+ssize_t zcache_writtenback_pages;
+ssize_t zcache_outstanding_writeback_pages;
 #endif
 /*
  * zcache core code starts here
@@ -354,7 +335,7 @@ static void *zcache_pampd_eph_create(char *data, size_t size, bool raw,
 	if (!raw) {
 		zcache_compress(page, &cdata, &clen);
 		if (clen > zbud_max_buddy_size()) {
-			zcache_compress_poor++;
+			inc_zcache_compress_poor();
 			goto out;
 		}
 	} else {
@@ -371,14 +352,14 @@ static void *zcache_pampd_eph_create(char *data, size_t size, bool raw,
 	if (newpage != NULL)
 		goto create_in_new_page;
 
-	zcache_failed_getfreepages++;
+	inc_zcache_failed_getfreepages();
 	/* can't allocate a page, evict an ephemeral page via LRU */
 	newpage = zcache_evict_eph_pageframe();
 	if (newpage == NULL) {
-		zcache_eph_ate_tail_failed++;
+		inc_zcache_eph_ate_tail_failed();
 		goto out;
 	}
-	zcache_eph_ate_tail++;
+	inc_zcache_eph_ate_tail();
 
 create_in_new_page:
 	pampd = (void *)zbud_create_prep(th, true, cdata, clen, newpage);
@@ -413,7 +394,7 @@ static void *zcache_pampd_pers_create(char *data, size_t size, bool raw,
 		zcache_compress(page, &cdata, &clen);
 	/* reject if compression is too poor */
 	if (clen > zbud_max_zsize) {
-		zcache_compress_poor++;
+		inc_zcache_compress_poor();
 		goto out;
 	}
 	/* reject if mean compression is too poor */
@@ -424,7 +405,7 @@ static void *zcache_pampd_pers_create(char *data, size_t size, bool raw,
 		zbud_mean_zsize = div_u64(total_zsize,
 					curr_pers_zpages);
 		if (zbud_mean_zsize > zbud_max_mean_zsize) {
-			zcache_mean_compress_poor++;
+			inc_zcache_mean_compress_poor();
 			goto out;
 		}
 	}
@@ -445,14 +426,14 @@ create_pampd:
 	 * (global_page_state(NR_LRU_BASE + LRU_ACTIVE_FILE) +
 	 * global_page_state(NR_LRU_BASE + LRU_INACTIVE_FILE)))
 	 */
-	zcache_failed_getfreepages++;
+	inc_zcache_failed_getfreepages();
 	/* can't allocate a page, evict an ephemeral page via LRU */
 	newpage = zcache_evict_eph_pageframe();
 	if (newpage == NULL) {
-		zcache_pers_ate_eph_failed++;
+		inc_zcache_pers_ate_eph_failed();
 		goto out;
 	}
-	zcache_pers_ate_eph++;
+	inc_zcache_pers_ate_eph();
 
 create_in_new_page:
 	pampd = (void *)zbud_create_prep(th, false, cdata, clen, newpage);
@@ -492,7 +473,7 @@ void *zcache_pampd_create(char *data, unsigned int size, bool raw,
 			objnode = kmem_cache_alloc(zcache_objnode_cache,
 							ZCACHE_GFP_MASK);
 			if (unlikely(objnode == NULL)) {
-				zcache_failed_alloc++;
+				inc_zcache_failed_alloc();
 				goto out;
 			}
 			kp->objnodes[i] = objnode;
@@ -503,7 +484,7 @@ void *zcache_pampd_create(char *data, unsigned int size, bool raw,
 		kp->obj = obj;
 	}
 	if (unlikely(kp->obj == NULL)) {
-		zcache_failed_alloc++;
+		inc_zcache_failed_alloc();
 		goto out;
 	}
 	/*
@@ -781,9 +762,9 @@ static struct page *zcache_evict_eph_pageframe(void)
 		goto out;
 	dec_zcache_eph_zbytes(zsize);
 	dec_zcache_eph_zpages(zpages);
-	zcache_evicted_eph_zpages += zpages;
+	inc_zcache_evicted_eph_zpages(zpages);
 	dec_zcache_eph_pageframes();
-	zcache_evicted_eph_pageframes++;
+	inc_zcache_evicted_eph_pageframes();
 out:
 	return page;
 }
@@ -1166,9 +1147,9 @@ int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp,
 		if (pampd == NULL) {
 			ret = -ENOMEM;
 			if (ephemeral)
-				zcache_failed_eph_puts++;
+				inc_zcache_failed_eph_puts();
 			else
-				zcache_failed_pers_puts++;
+				inc_zcache_failed_pers_puts();
 		} else {
 			if (ramster_enabled)
 				ramster_do_preload_flnode(pool);
@@ -1178,7 +1159,7 @@ int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp,
 		}
 		zcache_put_pool(pool);
 	} else {
-		zcache_put_to_flush++;
+		inc_zcache_put_to_flush();
 		if (ramster_enabled)
 			ramster_do_preload_flnode(pool);
 		if (atomic_read(&pool->obj_count) > 0)
@@ -1228,7 +1209,7 @@ int zcache_flush_page(int cli_id, int pool_id,
 	unsigned long flags;
 
 	local_irq_save(flags);
-	zcache_flush_total++;
+	inc_zcache_flush_total();
 	pool = zcache_get_pool_by_id(cli_id, pool_id);
 	if (ramster_enabled)
 		ramster_do_preload_flnode(pool);
@@ -1238,7 +1219,7 @@ int zcache_flush_page(int cli_id, int pool_id,
 		zcache_put_pool(pool);
 	}
 	if (ret >= 0)
-		zcache_flush_found++;
+		inc_zcache_flush_found();
 	local_irq_restore(flags);
 	return ret;
 }
@@ -1251,7 +1232,7 @@ int zcache_flush_object(int cli_id, int pool_id,
 	unsigned long flags;
 
 	local_irq_save(flags);
-	zcache_flobj_total++;
+	inc_zcache_flobj_total();
 	pool = zcache_get_pool_by_id(cli_id, pool_id);
 	if (ramster_enabled)
 		ramster_do_preload_flnode(pool);
@@ -1261,7 +1242,7 @@ int zcache_flush_object(int cli_id, int pool_id,
 		zcache_put_pool(pool);
 	}
 	if (ret >= 0)
-		zcache_flobj_found++;
+		inc_zcache_flobj_found();
 	local_irq_restore(flags);
 	return ret;
 }
@@ -1424,7 +1405,7 @@ static void zcache_cleancache_put_page(int pool_id,
 	struct tmem_oid oid = *(struct tmem_oid *)&key;
 
 	if (!disable_cleancache_ignore_nonactive && !PageWasActive(page)) {
-		zcache_eph_nonactive_puts_ignored++;
+		inc_zcache_eph_nonactive_puts_ignored();
 		return;
 	}
 	if (likely(ind == index))
@@ -1553,7 +1534,7 @@ static int zcache_frontswap_put_page(unsigned type, pgoff_t offset,
 
 	BUG_ON(!PageLocked(page));
 	if (!disable_frontswap_ignore_nonactive && !PageWasActive(page)) {
-		zcache_pers_nonactive_puts_ignored++;
+		inc_zcache_pers_nonactive_puts_ignored();
 		ret = -ERANGE;
 		goto out;
 	}
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/16] zcache: Module license is defined twice.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (8 preceding siblings ...)
  2013-02-14  3:04 ` [PATCH 09/16] zcache: Move the last of the debugfs counters out Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 11/16] zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG Konrad Rzeszutek Wilk
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

The other (same license) is at the end of the file.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 059c0f2..4b9ee7f 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -73,8 +73,6 @@ static char *namestr __read_mostly = "zcache";
 #define ZCACHE_GFP_MASK \
 	(__GFP_FS | __GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC)
 
-MODULE_LICENSE("GPL");
-
 /* crypto API for zcache  */
 #define ZCACHE_COMP_NAME_SZ CRYPTO_MAX_ALG_NAME
 static char zcache_comp_name[ZCACHE_COMP_NAME_SZ] __read_mostly;
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/16] zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (9 preceding siblings ...)
  2013-02-14  3:05 ` [PATCH 10/16] zcache: Module license is defined twice Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 12/16] zcache/zbud: Fix compiler warnings Konrad Rzeszutek Wilk
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

and also define this extra attribute in the Kconfig entry.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/Kconfig       | 8 ++++++++
 drivers/staging/zcache/debug.c       | 2 +-
 drivers/staging/zcache/zcache-main.c | 6 +++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig
index 7358270..2da6cc4 100644
--- a/drivers/staging/zcache/Kconfig
+++ b/drivers/staging/zcache/Kconfig
@@ -10,6 +10,14 @@ config ZCACHE
 	  memory to store clean page cache pages and swap in RAM,
 	  providing a noticeable reduction in disk I/O.
 
+config ZCACHE_DEBUG
+	bool "Enable debug statistics"
+	depends on DEBUG_FS && ZCACHE
+	default n
+	help
+	  This is used to provide an debugfs directory with counters of
+	  how zcache is doing. You probably want to set this to 'N'.
+
 config RAMSTER
 	bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem"
 	depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE=y
diff --git a/drivers/staging/zcache/debug.c b/drivers/staging/zcache/debug.c
index cf19adc..e951c64 100644
--- a/drivers/staging/zcache/debug.c
+++ b/drivers/staging/zcache/debug.c
@@ -1,7 +1,7 @@
 #include <linux/atomic.h>
 #include "debug.h"
 
-#ifdef CONFIG_DEBUG_FS
+#ifdef CONFIG_ZCACHE_DEBUG
 #include <linux/debugfs.h>
 
 #define ATTR(x)  { .name = #x, .val = &zcache_##x, }
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 4b9ee7f..7c0fda4 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -306,7 +306,7 @@ static void zcache_free_page(struct page *page)
 		max_pageframes = curr_pageframes;
 	if (curr_pageframes < min_pageframes)
 		min_pageframes = curr_pageframes;
-#ifdef ZCACHE_DEBUG
+#ifdef CONFIG_ZCACHE_DEBUG
 	if (curr_pageframes > 2L || curr_pageframes < -2L) {
 		/* pr_info here */
 	}
@@ -1774,7 +1774,7 @@ static int __init zcache_init(void)
 		old_ops = zcache_cleancache_register_ops();
 		pr_info("%s: cleancache enabled using kernel transcendent "
 			"memory and compression buddies\n", namestr);
-#ifdef ZCACHE_DEBUG
+#ifdef CONFIG_ZCACHE_DEBUG
 		pr_info("%s: cleancache: ignorenonactive = %d\n",
 			namestr, !disable_cleancache_ignore_nonactive);
 #endif
@@ -1789,7 +1789,7 @@ static int __init zcache_init(void)
 			frontswap_tmem_exclusive_gets(true);
 		pr_info("%s: frontswap enabled using kernel transcendent "
 			"memory and compression buddies\n", namestr);
-#ifdef ZCACHE_DEBUG
+#ifdef CONFIG_ZCACHE_DEBUG
 		pr_info("%s: frontswap: excl gets = %d active only = %d\n",
 			namestr, frontswap_has_exclusive_gets,
 			!disable_frontswap_ignore_nonactive);
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 12/16] zcache/zbud: Fix compiler warnings.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (10 preceding siblings ...)
  2013-02-14  3:05 ` [PATCH 11/16] zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 13/16] zcache/zbud: Add incremental accessory counters Konrad Rzeszutek Wilk
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

We get tons of:
drivers/staging/zcache/zbud.c: In function ‘zbud_debugfs_init’:
drivers/staging/zcache/zbud.c:323:2: warning: passing argument 4 of
‘debugfs_create_size_t’ from incompatible pointer type [enabled by
default]
In file included from drivers/staging/zcache/zbud.c:305:0:

This fixes it

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zbud.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index 6835fab..4654978 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -281,26 +281,26 @@ static inline char *zbud_data(void *zbpg,
  * debugfs viewers, some of these should also be atomic_long_t, but
  * I don't know how to expose atomics via debugfs either...
  */
-static unsigned long zbud_eph_pageframes;
-static unsigned long zbud_pers_pageframes;
-static unsigned long zbud_eph_zpages;
-static unsigned long zbud_pers_zpages;
+static ssize_t zbud_eph_pageframes;
+static ssize_t zbud_pers_pageframes;
+static ssize_t zbud_eph_zpages;
+static ssize_t zbud_pers_zpages;
 static u64 zbud_eph_zbytes;
 static u64 zbud_pers_zbytes;
-static unsigned long zbud_eph_evicted_pageframes;
-static unsigned long zbud_pers_evicted_pageframes;
-static unsigned long zbud_eph_cumul_zpages;
-static unsigned long zbud_pers_cumul_zpages;
+static ssize_t zbud_eph_evicted_pageframes;
+static ssize_t zbud_pers_evicted_pageframes;
+static ssize_t zbud_eph_cumul_zpages;
+static ssize_t zbud_pers_cumul_zpages;
 static u64 zbud_eph_cumul_zbytes;
 static u64 zbud_pers_cumul_zbytes;
-static unsigned long zbud_eph_cumul_chunk_counts[NCHUNKS];
-static unsigned long zbud_pers_cumul_chunk_counts[NCHUNKS];
-static unsigned long zbud_eph_buddied_count;
-static unsigned long zbud_pers_buddied_count;
-static unsigned long zbud_eph_unbuddied_count;
-static unsigned long zbud_pers_unbuddied_count;
-static unsigned long zbud_eph_zombie_count;
-static unsigned long zbud_pers_zombie_count;
+static ssize_t zbud_eph_cumul_chunk_counts[NCHUNKS];
+static ssize_t zbud_pers_cumul_chunk_counts[NCHUNKS];
+static ssize_t zbud_eph_buddied_count;
+static ssize_t zbud_pers_buddied_count;
+static ssize_t zbud_eph_unbuddied_count;
+static ssize_t zbud_pers_unbuddied_count;
+static ssize_t zbud_eph_zombie_count;
+static ssize_t zbud_pers_zombie_count;
 static atomic_t zbud_eph_zombie_atomic;
 static atomic_t zbud_pers_zombie_atomic;
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 13/16] zcache/zbud: Add incremental accessory counters
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (11 preceding siblings ...)
  2013-02-14  3:05 ` [PATCH 12/16] zcache/zbud: Fix compiler warnings Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 14/16] zcache/zbud: Provide the accessory functions for counter decrease Konrad Rzeszutek Wilk
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

that are going to be used for debug fs entries.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zbud.c | 58 +++++++++++++++++++++++++++++--------------
 1 file changed, 39 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index 4654978..cff596c 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -301,6 +301,26 @@ static ssize_t zbud_eph_unbuddied_count;
 static ssize_t zbud_pers_unbuddied_count;
 static ssize_t zbud_eph_zombie_count;
 static ssize_t zbud_pers_zombie_count;
+static inline void inc_zbud_eph_pageframes(void) { zbud_eph_pageframes++; };
+static inline void inc_zbud_pers_pageframes(void) { zbud_pers_pageframes++; };
+static inline void inc_zbud_eph_zpages(void) { zbud_eph_zpages++; };
+static inline void inc_zbud_pers_zpages(void) { zbud_pers_zpages++; };
+static inline void inc_zbud_eph_zbytes(ssize_t bytes) { zbud_eph_zbytes += bytes; };
+static inline void inc_zbud_pers_zbytes(ssize_t bytes) { zbud_pers_zbytes += bytes; };
+static inline void inc_zbud_eph_evicted_pageframes(void) { zbud_eph_evicted_pageframes++; };
+static inline void inc_zbud_pers_evicted_pageframes(void) { zbud_pers_evicted_pageframes++; };
+static inline void inc_zbud_eph_cumul_zpages(void) { zbud_eph_cumul_zpages++; };
+static inline void inc_zbud_pers_cumul_zpages(void) { zbud_pers_cumul_zpages++; };
+static inline void inc_zbud_eph_cumul_zbytes(ssize_t bytes) { zbud_eph_cumul_zbytes += bytes; };
+static inline void inc_zbud_pers_cumul_zbytes(ssize_t bytes) { zbud_pers_cumul_zbytes += bytes; };
+static inline void inc_zbud_eph_cumul_chunk_counts(unsigned n) { zbud_eph_cumul_chunk_counts[n]++; };
+static inline void inc_zbud_pers_cumul_chunk_counts(unsigned n) { zbud_pers_cumul_chunk_counts[n]++; };
+static inline void inc_zbud_eph_buddied_count(void) { zbud_eph_buddied_count++; };
+static inline void inc_zbud_pers_buddied_count(void) { zbud_pers_buddied_count++; };
+static inline void inc_zbud_eph_unbuddied_count(void) { zbud_eph_unbuddied_count++; };
+static inline void inc_zbud_pers_unbuddied_count(void) { zbud_pers_unbuddied_count++; };
+static inline void inc_zbud_eph_zombie_count(void) { zbud_eph_zombie_count++; };
+static inline void inc_zbud_pers_zombie_count(void) { zbud_pers_zombie_count++; };
 static atomic_t zbud_eph_zombie_atomic;
 static atomic_t zbud_pers_zombie_atomic;
 
@@ -379,9 +399,9 @@ static inline struct zbudpage *zbud_init_zbudpage(struct page *page, bool eph)
 	zbudpage->zbud1_size = 0;
 	zbudpage->unevictable = 0;
 	if (eph)
-		zbud_eph_pageframes++;
+		inc_zbud_eph_pageframes();
 	else
-		zbud_pers_pageframes++;
+		inc_zbud_pers_pageframes();
 	return zbudpage;
 }
 
@@ -465,17 +485,17 @@ static void zbud_init_zbud(struct zbudpage *zbudpage, struct tmem_handle *th,
 	else
 		zbudpage->zbud1_size = size;
 	if (eph) {
-		zbud_eph_cumul_chunk_counts[nchunks]++;
-		zbud_eph_zpages++;
-		zbud_eph_cumul_zpages++;
-		zbud_eph_zbytes += size;
-		zbud_eph_cumul_zbytes += size;
+		inc_zbud_eph_cumul_chunk_counts(nchunks);
+		inc_zbud_eph_zpages();
+		inc_zbud_eph_cumul_zpages();
+		inc_zbud_eph_zbytes(size);
+		inc_zbud_eph_cumul_zbytes(size);
 	} else {
-		zbud_pers_cumul_chunk_counts[nchunks]++;
-		zbud_pers_zpages++;
-		zbud_pers_cumul_zpages++;
-		zbud_pers_zbytes += size;
-		zbud_pers_cumul_zbytes += size;
+		inc_zbud_pers_cumul_chunk_counts(nchunks);
+		inc_zbud_pers_zpages();
+		inc_zbud_pers_cumul_zpages();
+		inc_zbud_pers_zbytes(size);
+		inc_zbud_pers_cumul_zbytes(size);
 	}
 }
 
@@ -603,9 +623,9 @@ struct page *zbud_free_and_delist(struct zbudref *zref, bool eph,
 		}
 		if (eph) {
 			zbud_eph_buddied_count--;
-			zbud_eph_unbuddied_count++;
+			inc_zbud_eph_unbuddied_count();
 		} else {
-			zbud_pers_unbuddied_count++;
+			inc_zbud_pers_unbuddied_count();
 			zbud_pers_buddied_count--;
 		}
 		/* don't mess with lru, no need to move it */
@@ -664,7 +684,7 @@ found_unbuddied:
 		list_add_tail(&zbudpage->budlist, &zbud_eph_buddied_list);
 		unbud[found_good_buddy].count--;
 		zbud_eph_unbuddied_count--;
-		zbud_eph_buddied_count++;
+		inc_zbud_eph_buddied_count();
 		/* "promote" raw zbudpage to most-recently-used */
 		list_del_init(&zbudpage->lru);
 		list_add_tail(&zbudpage->lru, &zbud_eph_lru_list);
@@ -672,7 +692,7 @@ found_unbuddied:
 		list_add_tail(&zbudpage->budlist, &zbud_pers_buddied_list);
 		unbud[found_good_buddy].count--;
 		zbud_pers_unbuddied_count--;
-		zbud_pers_buddied_count++;
+		inc_zbud_pers_buddied_count();
 		/* "promote" raw zbudpage to most-recently-used */
 		list_del_init(&zbudpage->lru);
 		list_add_tail(&zbudpage->lru, &zbud_pers_lru_list);
@@ -723,10 +743,10 @@ struct zbudref *zbud_create_prep(struct tmem_handle *th, bool eph,
 	list_add_tail(&zbudpage->budlist, &unbud[nchunks].list);
 	if (eph) {
 		list_add_tail(&zbudpage->lru, &zbud_eph_lru_list);
-		zbud_eph_unbuddied_count++;
+		inc_zbud_eph_unbuddied_count();
 	} else {
 		list_add_tail(&zbudpage->lru, &zbud_pers_lru_list);
-		zbud_pers_unbuddied_count++;
+		inc_zbud_pers_unbuddied_count();
 	}
 	unbud[nchunks].count++;
 	zbud_init_zbud(zbudpage, th, eph, cdata, budnum, size);
@@ -951,7 +971,7 @@ evict_page:
 		BUG();
 	}
 	spin_unlock(&zbud_eph_lists_lock);
-	zbud_eph_evicted_pageframes++;
+	inc_zbud_eph_evicted_pageframes();
 	if (*zpages == 1)
 		zbud_eph_unbuddied_count--;
 	else
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 14/16] zcache/zbud: Provide the accessory functions for counter decrease.
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (12 preceding siblings ...)
  2013-02-14  3:05 ` [PATCH 13/16] zcache/zbud: Add incremental accessory counters Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 15/16] ramster: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 16/16] zcache/zbud: Fix __init mismatch Konrad Rzeszutek Wilk
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zbud.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index cff596c..e139cd6 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -321,6 +321,16 @@ static inline void inc_zbud_eph_unbuddied_count(void) { zbud_eph_unbuddied_count
 static inline void inc_zbud_pers_unbuddied_count(void) { zbud_pers_unbuddied_count++; };
 static inline void inc_zbud_eph_zombie_count(void) { zbud_eph_zombie_count++; };
 static inline void inc_zbud_pers_zombie_count(void) { zbud_pers_zombie_count++; };
+static inline void dec_zbud_eph_pageframes(void) { zbud_eph_pageframes--; };
+static inline void dec_zbud_pers_pageframes(void) { zbud_pers_pageframes--; };
+static inline void dec_zbud_eph_zpages(void) { zbud_eph_zpages--; };
+static inline void dec_zbud_pers_zpages(void) { zbud_pers_zpages--; };
+static inline void dec_zbud_eph_zbytes(ssize_t bytes) { zbud_eph_zbytes -= bytes; };
+static inline void dec_zbud_pers_zbytes(ssize_t bytes) { zbud_pers_zbytes -= bytes; };
+static inline void dec_zbud_eph_buddied_count(void) { zbud_eph_buddied_count--; };
+static inline void dec_zbud_pers_buddied_count(void) { zbud_pers_buddied_count--; };
+static inline void dec_zbud_eph_unbuddied_count(void) { zbud_eph_unbuddied_count--; };
+static inline void dec_zbud_pers_unbuddied_count(void) { zbud_pers_unbuddied_count--; };
 static atomic_t zbud_eph_zombie_atomic;
 static atomic_t zbud_pers_zombie_atomic;
 
@@ -420,9 +430,9 @@ static inline struct page *zbud_unuse_zbudpage(struct zbudpage *zbudpage,
 	BUG_ON(zbudpage_is_dying(zbudpage));
 	BUG_ON(zbudpage_is_zombie(zbudpage));
 	if (eph)
-		zbud_eph_pageframes--;
+		dec_zbud_eph_pageframes();
 	else
-		zbud_pers_pageframes--;
+		dec_zbud_pers_pageframes();
 	zbudpage_spin_unlock(zbudpage);
 	reset_page_mapcount(page);
 	init_page_count(page);
@@ -445,11 +455,11 @@ static inline void zbud_unuse_zbud(struct zbudpage *zbudpage,
 		zbudpage->zbud1_size = 0;
 	}
 	if (eph) {
-		zbud_eph_zbytes -= size;
-		zbud_eph_zpages--;
+		dec_zbud_eph_zbytes(size);
+		dec_zbud_eph_zpages();
 	} else {
-		zbud_pers_zbytes -= size;
-		zbud_pers_zpages--;
+		dec_zbud_pers_zbytes(size);
+		dec_zbud_pers_zpages();
 	}
 }
 
@@ -610,9 +620,9 @@ struct page *zbud_free_and_delist(struct zbudref *zref, bool eph,
 		list_del_init(&zbudpage->lru);
 		spin_unlock(lists_lock);
 		if (eph)
-			zbud_eph_unbuddied_count--;
+			dec_zbud_eph_unbuddied_count();
 		else
-			zbud_pers_unbuddied_count--;
+			dec_zbud_pers_unbuddied_count();
 		page = zbud_unuse_zbudpage(zbudpage, eph);
 	} else { /* was buddied: move remaining buddy to unbuddied list */
 		chunks = zbud_size_to_chunks(other_bud_size) ;
@@ -622,11 +632,11 @@ struct page *zbud_free_and_delist(struct zbudref *zref, bool eph,
 			unbud[chunks].count++;
 		}
 		if (eph) {
-			zbud_eph_buddied_count--;
+			dec_zbud_eph_buddied_count();
 			inc_zbud_eph_unbuddied_count();
 		} else {
 			inc_zbud_pers_unbuddied_count();
-			zbud_pers_buddied_count--;
+			dec_zbud_pers_buddied_count();
 		}
 		/* don't mess with lru, no need to move it */
 		zbudpage_spin_unlock(zbudpage);
@@ -683,7 +693,7 @@ found_unbuddied:
 	if (eph) {
 		list_add_tail(&zbudpage->budlist, &zbud_eph_buddied_list);
 		unbud[found_good_buddy].count--;
-		zbud_eph_unbuddied_count--;
+		dec_zbud_eph_unbuddied_count();
 		inc_zbud_eph_buddied_count();
 		/* "promote" raw zbudpage to most-recently-used */
 		list_del_init(&zbudpage->lru);
@@ -691,7 +701,7 @@ found_unbuddied:
 	} else {
 		list_add_tail(&zbudpage->budlist, &zbud_pers_buddied_list);
 		unbud[found_good_buddy].count--;
-		zbud_pers_unbuddied_count--;
+		dec_zbud_pers_unbuddied_count();
 		inc_zbud_pers_buddied_count();
 		/* "promote" raw zbudpage to most-recently-used */
 		list_del_init(&zbudpage->lru);
@@ -973,9 +983,9 @@ evict_page:
 	spin_unlock(&zbud_eph_lists_lock);
 	inc_zbud_eph_evicted_pageframes();
 	if (*zpages == 1)
-		zbud_eph_unbuddied_count--;
+		dec_zbud_eph_unbuddied_count();
 	else
-		zbud_eph_buddied_count--;
+		dec_zbud_eph_buddied_count();
 	zbud_evict_tmem(zbudpage);
 	zbudpage_spin_lock(zbudpage);
 	zbudpage_clear_dying(zbudpage);
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 15/16] ramster: Fix compile warnings due to usage of debugfs_create_size_t
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (13 preceding siblings ...)
  2013-02-14  3:05 ` [PATCH 14/16] zcache/zbud: Provide the accessory functions for counter decrease Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  2013-02-14  3:05 ` [PATCH 16/16] zcache/zbud: Fix __init mismatch Konrad Rzeszutek Wilk
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

We get tons of "note: expected ‘size_t *’ but argument is of type ‘long
int *’" warnings. This fixes it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/ramster/ramster.c | 34 ++++++++++++++++----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c
index c06709f..bf96a1c 100644
--- a/drivers/staging/zcache/ramster/ramster.c
+++ b/drivers/staging/zcache/ramster/ramster.c
@@ -67,25 +67,25 @@ static int ramster_remote_target_nodenum __read_mostly = -1;
 static long ramster_flnodes;
 static atomic_t ramster_flnodes_atomic = ATOMIC_INIT(0);
 static unsigned long ramster_flnodes_max;
-static long ramster_foreign_eph_pages;
+static ssize_t ramster_foreign_eph_pages;
 static atomic_t ramster_foreign_eph_pages_atomic = ATOMIC_INIT(0);
-static unsigned long ramster_foreign_eph_pages_max;
-static long ramster_foreign_pers_pages;
+static ssize_t ramster_foreign_eph_pages_max;
+static ssize_t ramster_foreign_pers_pages;
 static atomic_t ramster_foreign_pers_pages_atomic = ATOMIC_INIT(0);
-static unsigned long ramster_foreign_pers_pages_max;
-static unsigned long ramster_eph_pages_remoted;
-static unsigned long ramster_pers_pages_remoted;
-static unsigned long ramster_eph_pages_remote_failed;
-static unsigned long ramster_pers_pages_remote_failed;
-static unsigned long ramster_remote_eph_pages_succ_get;
-static unsigned long ramster_remote_pers_pages_succ_get;
-static unsigned long ramster_remote_eph_pages_unsucc_get;
-static unsigned long ramster_remote_pers_pages_unsucc_get;
-static unsigned long ramster_pers_pages_remote_nomem;
-static unsigned long ramster_remote_objects_flushed;
-static unsigned long ramster_remote_object_flushes_failed;
-static unsigned long ramster_remote_pages_flushed;
-static unsigned long ramster_remote_page_flushes_failed;
+static ssize_t ramster_foreign_pers_pages_max;
+static ssize_t ramster_eph_pages_remoted;
+static ssize_t ramster_pers_pages_remoted;
+static ssize_t ramster_eph_pages_remote_failed;
+static ssize_t ramster_pers_pages_remote_failed;
+static ssize_t ramster_remote_eph_pages_succ_get;
+static ssize_t ramster_remote_pers_pages_succ_get;
+static ssize_t ramster_remote_eph_pages_unsucc_get;
+static ssize_t ramster_remote_pers_pages_unsucc_get;
+static ssize_t ramster_pers_pages_remote_nomem;
+static ssize_t ramster_remote_objects_flushed;
+static ssize_t ramster_remote_object_flushes_failed;
+static ssize_t ramster_remote_pages_flushed;
+static ssize_t ramster_remote_page_flushes_failed;
 /* FIXME frontswap selfshrinking knobs in debugfs? */
 
 #ifdef CONFIG_DEBUG_FS
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 16/16] zcache/zbud: Fix __init mismatch
  2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
                   ` (14 preceding siblings ...)
  2013-02-14  3:05 ` [PATCH 15/16] ramster: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
@ 2013-02-14  3:05 ` Konrad Rzeszutek Wilk
  15 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14  3:05 UTC (permalink / raw)
  To: linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj, Konrad Rzeszutek Wilk

We get:
WARNING: drivers/staging/zcache/zcache.o(.text+0x13a1): Section mismatch
in reference from the function zcache_init() to the function
.init.text:zbud_init()
The function zcache_init() references
the function __init zbud_init().
This is often because zcache_init lacks a __init
annotation or the annotation of zbud_init is wrong.

And this fixes it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zbud.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index e139cd6..9aa5bd8 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -1077,7 +1077,7 @@ out:
 	return ret;
 }
 
-void __init zbud_init(void)
+void zbud_init(void)
 {
 	int i;
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* RE: [PATCH] Various cleanups/fixes to zcache (v3).
       [not found] <<1360811106-2679-1-git-send-email-konrad.wilk@oracle.com>
@ 2013-02-14 16:56 ` Dan Magenheimer
  2013-02-14 16:59   ` Greg KH
  0 siblings, 1 reply; 30+ messages in thread
From: Dan Magenheimer @ 2013-02-14 16:56 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, linux-kernel, devel, dan.magenheimer, gregkh
  Cc: sjenning, rcj

> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> 
> From Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> # This line is ignored.
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> In-Reply-To:
> 
> Hey Greg,
> 
> These patches do various cleanups of the zcache driver. The majority of the
> work is just to move all the different counters out to a debug file. The next
> step would be to figure out which ones are actually pertient and which can
> go under the knife. Oh, and also fix some of the compiler warnings.
> 
> This is based on top of ommit 76426daf50d5df38893cc189e9ccd026093debc8
> ("staging/zcache: Fix/improve zcache writeback code, tie to a config option")
> so should apply cleanly to your tree.
> 
> Please apply.

Useful cleanups.

Hopefully not too late for 3.9-rc0.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Various cleanups/fixes to zcache (v3).
  2013-02-14 16:56 ` [PATCH] Various cleanups/fixes to zcache (v3) Dan Magenheimer
@ 2013-02-14 16:59   ` Greg KH
  2013-02-14 17:02     ` Dan Magenheimer
  0 siblings, 1 reply; 30+ messages in thread
From: Greg KH @ 2013-02-14 16:59 UTC (permalink / raw)
  To: Dan Magenheimer; +Cc: Konrad Rzeszutek Wilk, linux-kernel, devel, sjenning, rcj

On Thu, Feb 14, 2013 at 08:56:01AM -0800, Dan Magenheimer wrote:
> > From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > 
> > From Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> # This line is ignored.
> > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > In-Reply-To:
> > 
> > Hey Greg,
> > 
> > These patches do various cleanups of the zcache driver. The majority of the
> > work is just to move all the different counters out to a debug file. The next
> > step would be to figure out which ones are actually pertient and which can
> > go under the knife. Oh, and also fix some of the compiler warnings.
> > 
> > This is based on top of ommit 76426daf50d5df38893cc189e9ccd026093debc8
> > ("staging/zcache: Fix/improve zcache writeback code, tie to a config option")
> > so should apply cleanly to your tree.
> > 
> > Please apply.
> 
> Useful cleanups.
> 
> Hopefully not too late for 3.9-rc0.

You all did see my "the staging tree is closed except for bugfixes for
3.9" message last week, right?

Sorry, this will have to wait for 3.10.

greg k-h

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH] Various cleanups/fixes to zcache (v3).
  2013-02-14 16:59   ` Greg KH
@ 2013-02-14 17:02     ` Dan Magenheimer
  2013-02-14 17:29       ` Greg KH
  0 siblings, 1 reply; 30+ messages in thread
From: Dan Magenheimer @ 2013-02-14 17:02 UTC (permalink / raw)
  To: Greg KH; +Cc: Konrad Wilk, linux-kernel, devel, sjenning, rcj

> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Subject: Re: [PATCH] Various cleanups/fixes to zcache (v3).
> 
> On Thu, Feb 14, 2013 at 08:56:01AM -0800, Dan Magenheimer wrote:
> > > From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> > > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > >
> > > From Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> # This line is ignored.
> > > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > > In-Reply-To:
> > >
> > > Hey Greg,
> > >
> > > These patches do various cleanups of the zcache driver. The majority of the
> > > work is just to move all the different counters out to a debug file. The next
> > > step would be to figure out which ones are actually pertient and which can
> > > go under the knife. Oh, and also fix some of the compiler warnings.
> > >
> > > This is based on top of ommit 76426daf50d5df38893cc189e9ccd026093debc8
> > > ("staging/zcache: Fix/improve zcache writeback code, tie to a config option")
> > > so should apply cleanly to your tree.
> > >
> > > Please apply.
> >
> > Useful cleanups.
> >
> > Hopefully not too late for 3.9-rc0.
> 
> You all did see my "the staging tree is closed except for bugfixes for
> 3.9" message last week, right?

Oops, sorry, no I missed that.
 
> Sorry, this will have to wait for 3.10.

No problem, no bugs fixed here, though I expect we'll see
the same complaints posted again about the compiler warnings.

Dan

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Various cleanups/fixes to zcache (v3).
  2013-02-14 17:02     ` Dan Magenheimer
@ 2013-02-14 17:29       ` Greg KH
  2013-02-14 22:57         ` Konrad Rzeszutek Wilk
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 30+ messages in thread
From: Greg KH @ 2013-02-14 17:29 UTC (permalink / raw)
  To: Dan Magenheimer; +Cc: devel, rcj, sjenning, linux-kernel, Konrad Wilk

On Thu, Feb 14, 2013 at 09:02:47AM -0800, Dan Magenheimer wrote:
> > From: Greg KH [mailto:gregkh@linuxfoundation.org]
> > Subject: Re: [PATCH] Various cleanups/fixes to zcache (v3).
> > 
> > On Thu, Feb 14, 2013 at 08:56:01AM -0800, Dan Magenheimer wrote:
> > > > From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> > > > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > > >
> > > > From Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> # This line is ignored.
> > > > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > > > In-Reply-To:
> > > >
> > > > Hey Greg,
> > > >
> > > > These patches do various cleanups of the zcache driver. The majority of the
> > > > work is just to move all the different counters out to a debug file. The next
> > > > step would be to figure out which ones are actually pertient and which can
> > > > go under the knife. Oh, and also fix some of the compiler warnings.
> > > >
> > > > This is based on top of ommit 76426daf50d5df38893cc189e9ccd026093debc8
> > > > ("staging/zcache: Fix/improve zcache writeback code, tie to a config option")
> > > > so should apply cleanly to your tree.
> > > >
> > > > Please apply.
> > >
> > > Useful cleanups.
> > >
> > > Hopefully not too late for 3.9-rc0.
> > 
> > You all did see my "the staging tree is closed except for bugfixes for
> > 3.9" message last week, right?
> 
> Oops, sorry, no I missed that.
>  
> > Sorry, this will have to wait for 3.10.
> 
> No problem, no bugs fixed here, though I expect we'll see
> the same complaints posted again about the compiler warnings.

Then why not just redo that one patch, and send it to me, and then
rebase all of the other patches on top of it?  That way I can accept the
"fix the complier warnings" patch now, and the rest can wait.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Various cleanups/fixes to zcache (v3).
  2013-02-14 17:29       ` Greg KH
@ 2013-02-14 22:57         ` Konrad Rzeszutek Wilk
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-14 22:57 UTC (permalink / raw)
  To: Greg KH; +Cc: Dan Magenheimer, devel, rcj, sjenning, linux-kernel

On Thu, Feb 14, 2013 at 09:29:26AM -0800, Greg KH wrote:
> On Thu, Feb 14, 2013 at 09:02:47AM -0800, Dan Magenheimer wrote:
> > > From: Greg KH [mailto:gregkh@linuxfoundation.org]
> > > Subject: Re: [PATCH] Various cleanups/fixes to zcache (v3).
> > > 
> > > On Thu, Feb 14, 2013 at 08:56:01AM -0800, Dan Magenheimer wrote:
> > > > > From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> > > > > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > > > >
> > > > > From Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> # This line is ignored.
> > > > > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > > > Subject: [PATCH] Various cleanups/fixes to zcache (v3).
> > > > > In-Reply-To:
> > > > >
> > > > > Hey Greg,
> > > > >
> > > > > These patches do various cleanups of the zcache driver. The majority of the
> > > > > work is just to move all the different counters out to a debug file. The next
> > > > > step would be to figure out which ones are actually pertient and which can
> > > > > go under the knife. Oh, and also fix some of the compiler warnings.
> > > > >
> > > > > This is based on top of ommit 76426daf50d5df38893cc189e9ccd026093debc8
> > > > > ("staging/zcache: Fix/improve zcache writeback code, tie to a config option")
> > > > > so should apply cleanly to your tree.
> > > > >
> > > > > Please apply.
> > > >
> > > > Useful cleanups.
> > > >
> > > > Hopefully not too late for 3.9-rc0.
> > > 
> > > You all did see my "the staging tree is closed except for bugfixes for
> > > 3.9" message last week, right?
> > 
> > Oops, sorry, no I missed that.
> >  
> > > Sorry, this will have to wait for 3.10.
> > 
> > No problem, no bugs fixed here, though I expect we'll see
> > the same complaints posted again about the compiler warnings.
> 
> Then why not just redo that one patch, and send it to me, and then
> rebase all of the other patches on top of it?  That way I can accept the
> "fix the complier warnings" patch now, and the rest can wait.

Aye aye captain. Going to send them tomorrow (zbud/zcache).

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH] Compile bug-fixes to zcache (v4).
  2013-02-14 17:29       ` Greg KH
  2013-02-14 22:57         ` Konrad Rzeszutek Wilk
@ 2013-02-15 17:53         ` Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 1/4] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
                             ` (4 more replies)
  1 sibling, 5 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-15 17:53 UTC (permalink / raw)
  To: devel, gregkh, linux-kernel; +Cc: sjenning, rcj

> Then why not just redo that one patch, and send it to me, and then
> rebase all of the other patches on top of it?  That way I can accept the
> "fix the complier warnings" patch now, and the rest can wait.
> 
> thanks,
> 
> greg k-h

Hey Greg,

Please see these four patches which fix compile warnings.

They are also available at
 git://git.kernel.org/pub/scm/linux/kernel/git/konrad/mm.git stable/for-greg-3.9

if you prefer doing a git pull. The branch and this patchset are all
based on git commit 0bcc0429bdb9f7cca3b7ab1f905b0d47031c03e0
"staging: zcache: add TODO file"

Please pull or git am as you see fit.

 drivers/staging/zcache/ramster/ramster.c |  34 +++----
 drivers/staging/zcache/zbud.c            |  34 +++----
 drivers/staging/zcache/zcache-main.c     | 161 ++++++++++++++++---------------
 3 files changed, 115 insertions(+), 114 deletions(-)

Konrad Rzeszutek Wilk (4):
      zcache: Fix compile warnings due to usage of debugfs_create_size_t
      ramster: Fix compile warnings due to usage of debugfs_create_size_t
      zbud: Fix compile warnings due to usage of debugfs_create_size_t
      zcache/zbud: Fix __init mismatch


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/4] zcache: Fix compile warnings due to usage of debugfs_create_size_t
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
@ 2013-02-15 17:53           ` Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 2/4] ramster: " Konrad Rzeszutek Wilk
                             ` (3 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-15 17:53 UTC (permalink / raw)
  To: devel, gregkh, linux-kernel; +Cc: sjenning, rcj, Konrad Rzeszutek Wilk

When we compile we get tons of:
include/linux/debugfs.h:80:16: note: expected ‘size_t *’ but argument is
of type ‘long int *’
drivers/staging/zcache/zcache-main.c:279:2: warning: passing argument 4
of ‘debugfs_create_size_t’ from incompatible pointer type [enabled by d
efault]

which is b/c we end up using 'unsigned' or 'unsigned long' instead
of 'ssize_t'. So lets fix this up and use the proper type.

[v2: Rebased directly on staging]
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zcache-main.c | 161 ++++++++++++++++++-----------------
 1 file changed, 81 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 4456ab4..328898e 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -135,61 +135,62 @@ static struct kmem_cache *zcache_obj_cache;
 static DEFINE_PER_CPU(struct zcache_preload, zcache_preloads) = { 0, };
 
 /* we try to keep these statistics SMP-consistent */
-static long zcache_obj_count;
+static ssize_t zcache_obj_count;
 static atomic_t zcache_obj_atomic = ATOMIC_INIT(0);
-static long zcache_obj_count_max;
-static long zcache_objnode_count;
+static ssize_t zcache_obj_count_max;
+static ssize_t zcache_objnode_count;
 static atomic_t zcache_objnode_atomic = ATOMIC_INIT(0);
-static long zcache_objnode_count_max;
+static ssize_t zcache_objnode_count_max;
 static u64 zcache_eph_zbytes;
 static atomic_long_t zcache_eph_zbytes_atomic = ATOMIC_INIT(0);
 static u64 zcache_eph_zbytes_max;
 static u64 zcache_pers_zbytes;
 static atomic_long_t zcache_pers_zbytes_atomic = ATOMIC_INIT(0);
 static u64 zcache_pers_zbytes_max;
-static long zcache_eph_pageframes;
+static ssize_t zcache_eph_pageframes;
 static atomic_t zcache_eph_pageframes_atomic = ATOMIC_INIT(0);
-static long zcache_eph_pageframes_max;
-static long zcache_pers_pageframes;
+static ssize_t zcache_eph_pageframes_max;
+static ssize_t zcache_pers_pageframes;
 static atomic_t zcache_pers_pageframes_atomic = ATOMIC_INIT(0);
-static long zcache_pers_pageframes_max;
-static long zcache_pageframes_alloced;
+static ssize_t zcache_pers_pageframes_max;
+static ssize_t zcache_pageframes_alloced;
 static atomic_t zcache_pageframes_alloced_atomic = ATOMIC_INIT(0);
-static long zcache_pageframes_freed;
+static ssize_t zcache_pageframes_freed;
 static atomic_t zcache_pageframes_freed_atomic = ATOMIC_INIT(0);
-static long zcache_eph_zpages;
+static ssize_t zcache_eph_zpages;
+static ssize_t zcache_eph_zpages;
 static atomic_t zcache_eph_zpages_atomic = ATOMIC_INIT(0);
-static long zcache_eph_zpages_max;
-static long zcache_pers_zpages;
+static ssize_t zcache_eph_zpages_max;
+static ssize_t zcache_pers_zpages;
 static atomic_t zcache_pers_zpages_atomic = ATOMIC_INIT(0);
-static long zcache_pers_zpages_max;
+static ssize_t zcache_pers_zpages_max;
 
 /* but for the rest of these, counting races are ok */
-static unsigned long zcache_flush_total;
-static unsigned long zcache_flush_found;
-static unsigned long zcache_flobj_total;
-static unsigned long zcache_flobj_found;
-static unsigned long zcache_failed_eph_puts;
-static unsigned long zcache_failed_pers_puts;
-static unsigned long zcache_failed_getfreepages;
-static unsigned long zcache_failed_alloc;
-static unsigned long zcache_put_to_flush;
-static unsigned long zcache_compress_poor;
-static unsigned long zcache_mean_compress_poor;
-static unsigned long zcache_eph_ate_tail;
-static unsigned long zcache_eph_ate_tail_failed;
-static unsigned long zcache_pers_ate_eph;
-static unsigned long zcache_pers_ate_eph_failed;
-static unsigned long zcache_evicted_eph_zpages;
-static unsigned long zcache_evicted_eph_pageframes;
-static unsigned long zcache_last_active_file_pageframes;
-static unsigned long zcache_last_inactive_file_pageframes;
-static unsigned long zcache_last_active_anon_pageframes;
-static unsigned long zcache_last_inactive_anon_pageframes;
-static unsigned long zcache_eph_nonactive_puts_ignored;
-static unsigned long zcache_pers_nonactive_puts_ignored;
-static unsigned long zcache_writtenback_pages;
-static long zcache_outstanding_writeback_pages;
+static ssize_t zcache_flush_total;
+static ssize_t zcache_flush_found;
+static ssize_t zcache_flobj_total;
+static ssize_t zcache_flobj_found;
+static ssize_t zcache_failed_eph_puts;
+static ssize_t zcache_failed_pers_puts;
+static ssize_t zcache_failed_getfreepages;
+static ssize_t zcache_failed_alloc;
+static ssize_t zcache_put_to_flush;
+static ssize_t zcache_compress_poor;
+static ssize_t zcache_mean_compress_poor;
+static ssize_t zcache_eph_ate_tail;
+static ssize_t zcache_eph_ate_tail_failed;
+static ssize_t zcache_pers_ate_eph;
+static ssize_t zcache_pers_ate_eph_failed;
+static ssize_t zcache_evicted_eph_zpages;
+static ssize_t zcache_evicted_eph_pageframes;
+static ssize_t zcache_last_active_file_pageframes;
+static ssize_t zcache_last_inactive_file_pageframes;
+static ssize_t zcache_last_active_anon_pageframes;
+static ssize_t zcache_last_inactive_anon_pageframes;
+static ssize_t zcache_eph_nonactive_puts_ignored;
+static ssize_t zcache_pers_nonactive_puts_ignored;
+static ssize_t zcache_writtenback_pages;
+static ssize_t zcache_outstanding_writeback_pages;
 
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
@@ -262,64 +263,64 @@ static int zcache_debugfs_init(void)
 /* developers can call this in case of ooms, e.g. to find memory leaks */
 void zcache_dump(void)
 {
-	pr_info("zcache: obj_count=%lu\n", zcache_obj_count);
-	pr_info("zcache: obj_count_max=%lu\n", zcache_obj_count_max);
-	pr_info("zcache: objnode_count=%lu\n", zcache_objnode_count);
-	pr_info("zcache: objnode_count_max=%lu\n", zcache_objnode_count_max);
-	pr_info("zcache: flush_total=%lu\n", zcache_flush_total);
-	pr_info("zcache: flush_found=%lu\n", zcache_flush_found);
-	pr_info("zcache: flobj_total=%lu\n", zcache_flobj_total);
-	pr_info("zcache: flobj_found=%lu\n", zcache_flobj_found);
-	pr_info("zcache: failed_eph_puts=%lu\n", zcache_failed_eph_puts);
-	pr_info("zcache: failed_pers_puts=%lu\n", zcache_failed_pers_puts);
-	pr_info("zcache: failed_get_free_pages=%lu\n",
+	pr_info("zcache: obj_count=%zd\n", zcache_obj_count);
+	pr_info("zcache: obj_count_max=%zd\n", zcache_obj_count_max);
+	pr_info("zcache: objnode_count=%zd\n", zcache_objnode_count);
+	pr_info("zcache: objnode_count_max=%zd\n", zcache_objnode_count_max);
+	pr_info("zcache: flush_total=%zd\n", zcache_flush_total);
+	pr_info("zcache: flush_found=%zd\n", zcache_flush_found);
+	pr_info("zcache: flobj_total=%zd\n", zcache_flobj_total);
+	pr_info("zcache: flobj_found=%zd\n", zcache_flobj_found);
+	pr_info("zcache: failed_eph_puts=%zd\n", zcache_failed_eph_puts);
+	pr_info("zcache: failed_pers_puts=%zd\n", zcache_failed_pers_puts);
+	pr_info("zcache: failed_get_free_pages=%zd\n",
 				zcache_failed_getfreepages);
-	pr_info("zcache: failed_alloc=%lu\n", zcache_failed_alloc);
-	pr_info("zcache: put_to_flush=%lu\n", zcache_put_to_flush);
-	pr_info("zcache: compress_poor=%lu\n", zcache_compress_poor);
-	pr_info("zcache: mean_compress_poor=%lu\n",
+	pr_info("zcache: failed_alloc=%zd\n", zcache_failed_alloc);
+	pr_info("zcache: put_to_flush=%zd\n", zcache_put_to_flush);
+	pr_info("zcache: compress_poor=%zd\n", zcache_compress_poor);
+	pr_info("zcache: mean_compress_poor=%zd\n",
 				zcache_mean_compress_poor);
-	pr_info("zcache: eph_ate_tail=%lu\n", zcache_eph_ate_tail);
-	pr_info("zcache: eph_ate_tail_failed=%lu\n",
+	pr_info("zcache: eph_ate_tail=%zd\n", zcache_eph_ate_tail);
+	pr_info("zcache: eph_ate_tail_failed=%zd\n",
 				zcache_eph_ate_tail_failed);
-	pr_info("zcache: pers_ate_eph=%lu\n", zcache_pers_ate_eph);
-	pr_info("zcache: pers_ate_eph_failed=%lu\n",
+	pr_info("zcache: pers_ate_eph=%zd\n", zcache_pers_ate_eph);
+	pr_info("zcache: pers_ate_eph_failed=%zd\n",
 				zcache_pers_ate_eph_failed);
-	pr_info("zcache: evicted_eph_zpages=%lu\n", zcache_evicted_eph_zpages);
-	pr_info("zcache: evicted_eph_pageframes=%lu\n",
+	pr_info("zcache: evicted_eph_zpages=%zd\n", zcache_evicted_eph_zpages);
+	pr_info("zcache: evicted_eph_pageframes=%zd\n",
 				zcache_evicted_eph_pageframes);
-	pr_info("zcache: eph_pageframes=%lu\n", zcache_eph_pageframes);
-	pr_info("zcache: eph_pageframes_max=%lu\n", zcache_eph_pageframes_max);
-	pr_info("zcache: pers_pageframes=%lu\n", zcache_pers_pageframes);
-	pr_info("zcache: pers_pageframes_max=%lu\n",
+	pr_info("zcache: eph_pageframes=%zd\n", zcache_eph_pageframes);
+	pr_info("zcache: eph_pageframes_max=%zd\n", zcache_eph_pageframes_max);
+	pr_info("zcache: pers_pageframes=%zd\n", zcache_pers_pageframes);
+	pr_info("zcache: pers_pageframes_max=%zd\n",
 				zcache_pers_pageframes_max);
-	pr_info("zcache: eph_zpages=%lu\n", zcache_eph_zpages);
-	pr_info("zcache: eph_zpages_max=%lu\n", zcache_eph_zpages_max);
-	pr_info("zcache: pers_zpages=%lu\n", zcache_pers_zpages);
-	pr_info("zcache: pers_zpages_max=%lu\n", zcache_pers_zpages_max);
-	pr_info("zcache: last_active_file_pageframes=%lu\n",
+	pr_info("zcache: eph_zpages=%zd\n", zcache_eph_zpages);
+	pr_info("zcache: eph_zpages_max=%zd\n", zcache_eph_zpages_max);
+	pr_info("zcache: pers_zpages=%zd\n", zcache_pers_zpages);
+	pr_info("zcache: pers_zpages_max=%zd\n", zcache_pers_zpages_max);
+	pr_info("zcache: last_active_file_pageframes=%zd\n",
 				zcache_last_active_file_pageframes);
-	pr_info("zcache: last_inactive_file_pageframes=%lu\n",
+	pr_info("zcache: last_inactive_file_pageframes=%zd\n",
 				zcache_last_inactive_file_pageframes);
-	pr_info("zcache: last_active_anon_pageframes=%lu\n",
+	pr_info("zcache: last_active_anon_pageframes=%zd\n",
 				zcache_last_active_anon_pageframes);
-	pr_info("zcache: last_inactive_anon_pageframes=%lu\n",
+	pr_info("zcache: last_inactive_anon_pageframes=%zd\n",
 				zcache_last_inactive_anon_pageframes);
-	pr_info("zcache: eph_nonactive_puts_ignored=%lu\n",
+	pr_info("zcache: eph_nonactive_puts_ignored=%zd\n",
 				zcache_eph_nonactive_puts_ignored);
-	pr_info("zcache: pers_nonactive_puts_ignored=%lu\n",
+	pr_info("zcache: pers_nonactive_puts_ignored=%zd\n",
 				zcache_pers_nonactive_puts_ignored);
 	pr_info("zcache: eph_zbytes=%llu\n",
-				(unsigned long long)zcache_eph_zbytes);
+				zcache_eph_zbytes);
 	pr_info("zcache: eph_zbytes_max=%llu\n",
-				(unsigned long long)zcache_eph_zbytes_max);
+				zcache_eph_zbytes_max);
 	pr_info("zcache: pers_zbytes=%llu\n",
-				(unsigned long long)zcache_pers_zbytes);
+				zcache_pers_zbytes);
 	pr_info("zcache: pers_zbytes_max=%llu\n",
-				(unsigned long long)zcache_pers_zbytes_max);
-	pr_info("zcache: outstanding_writeback_pages=%lu\n",
+				zcache_pers_zbytes_max);
+	pr_info("zcache: outstanding_writeback_pages=%zd\n",
 				zcache_outstanding_writeback_pages);
-	pr_info("zcache: writtenback_pages=%lu\n", zcache_writtenback_pages);
+	pr_info("zcache: writtenback_pages=%zd\n", zcache_writtenback_pages);
 }
 #endif
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/4] ramster: Fix compile warnings due to usage of debugfs_create_size_t
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 1/4] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
@ 2013-02-15 17:53           ` Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 3/4] zbud: " Konrad Rzeszutek Wilk
                             ` (2 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-15 17:53 UTC (permalink / raw)
  To: devel, gregkh, linux-kernel; +Cc: sjenning, rcj, Konrad Rzeszutek Wilk

We get tons of "note: expected ‘size_t *’ but argument is of type ‘long
int *’" warnings. This fixes it.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/ramster/ramster.c | 34 ++++++++++++++++----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c
index c06709f..bf96a1c 100644
--- a/drivers/staging/zcache/ramster/ramster.c
+++ b/drivers/staging/zcache/ramster/ramster.c
@@ -67,25 +67,25 @@ static int ramster_remote_target_nodenum __read_mostly = -1;
 static long ramster_flnodes;
 static atomic_t ramster_flnodes_atomic = ATOMIC_INIT(0);
 static unsigned long ramster_flnodes_max;
-static long ramster_foreign_eph_pages;
+static ssize_t ramster_foreign_eph_pages;
 static atomic_t ramster_foreign_eph_pages_atomic = ATOMIC_INIT(0);
-static unsigned long ramster_foreign_eph_pages_max;
-static long ramster_foreign_pers_pages;
+static ssize_t ramster_foreign_eph_pages_max;
+static ssize_t ramster_foreign_pers_pages;
 static atomic_t ramster_foreign_pers_pages_atomic = ATOMIC_INIT(0);
-static unsigned long ramster_foreign_pers_pages_max;
-static unsigned long ramster_eph_pages_remoted;
-static unsigned long ramster_pers_pages_remoted;
-static unsigned long ramster_eph_pages_remote_failed;
-static unsigned long ramster_pers_pages_remote_failed;
-static unsigned long ramster_remote_eph_pages_succ_get;
-static unsigned long ramster_remote_pers_pages_succ_get;
-static unsigned long ramster_remote_eph_pages_unsucc_get;
-static unsigned long ramster_remote_pers_pages_unsucc_get;
-static unsigned long ramster_pers_pages_remote_nomem;
-static unsigned long ramster_remote_objects_flushed;
-static unsigned long ramster_remote_object_flushes_failed;
-static unsigned long ramster_remote_pages_flushed;
-static unsigned long ramster_remote_page_flushes_failed;
+static ssize_t ramster_foreign_pers_pages_max;
+static ssize_t ramster_eph_pages_remoted;
+static ssize_t ramster_pers_pages_remoted;
+static ssize_t ramster_eph_pages_remote_failed;
+static ssize_t ramster_pers_pages_remote_failed;
+static ssize_t ramster_remote_eph_pages_succ_get;
+static ssize_t ramster_remote_pers_pages_succ_get;
+static ssize_t ramster_remote_eph_pages_unsucc_get;
+static ssize_t ramster_remote_pers_pages_unsucc_get;
+static ssize_t ramster_pers_pages_remote_nomem;
+static ssize_t ramster_remote_objects_flushed;
+static ssize_t ramster_remote_object_flushes_failed;
+static ssize_t ramster_remote_pages_flushed;
+static ssize_t ramster_remote_page_flushes_failed;
 /* FIXME frontswap selfshrinking knobs in debugfs? */
 
 #ifdef CONFIG_DEBUG_FS
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/4] zbud: Fix compile warnings due to usage of debugfs_create_size_t
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 1/4] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 2/4] ramster: " Konrad Rzeszutek Wilk
@ 2013-02-15 17:53           ` Konrad Rzeszutek Wilk
  2013-02-15 17:53           ` [PATCH 4/4] zcache/zbud: Fix __init mismatch Konrad Rzeszutek Wilk
  2013-02-15 18:17           ` [PATCH] Compile bug-fixes to zcache (v4) Greg KH
  4 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-15 17:53 UTC (permalink / raw)
  To: devel, gregkh, linux-kernel; +Cc: sjenning, rcj, Konrad Rzeszutek Wilk

.
drivers/staging/zcache/zbud.c:336: warning: passing argument 4 of ‘debugfs_create_size_t’ from incompatible pointer type
include/linux/debugfs.h:80: note: expected ‘size_t *’ but argument is of type ‘long unsigned int *’
..

which is b/c we end up using 'unsigned' or 'unsigned long' instead
of 'ssize_t'. So lets fix this up and use the proper type.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zbud.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index 6835fab..4654978 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -281,26 +281,26 @@ static inline char *zbud_data(void *zbpg,
  * debugfs viewers, some of these should also be atomic_long_t, but
  * I don't know how to expose atomics via debugfs either...
  */
-static unsigned long zbud_eph_pageframes;
-static unsigned long zbud_pers_pageframes;
-static unsigned long zbud_eph_zpages;
-static unsigned long zbud_pers_zpages;
+static ssize_t zbud_eph_pageframes;
+static ssize_t zbud_pers_pageframes;
+static ssize_t zbud_eph_zpages;
+static ssize_t zbud_pers_zpages;
 static u64 zbud_eph_zbytes;
 static u64 zbud_pers_zbytes;
-static unsigned long zbud_eph_evicted_pageframes;
-static unsigned long zbud_pers_evicted_pageframes;
-static unsigned long zbud_eph_cumul_zpages;
-static unsigned long zbud_pers_cumul_zpages;
+static ssize_t zbud_eph_evicted_pageframes;
+static ssize_t zbud_pers_evicted_pageframes;
+static ssize_t zbud_eph_cumul_zpages;
+static ssize_t zbud_pers_cumul_zpages;
 static u64 zbud_eph_cumul_zbytes;
 static u64 zbud_pers_cumul_zbytes;
-static unsigned long zbud_eph_cumul_chunk_counts[NCHUNKS];
-static unsigned long zbud_pers_cumul_chunk_counts[NCHUNKS];
-static unsigned long zbud_eph_buddied_count;
-static unsigned long zbud_pers_buddied_count;
-static unsigned long zbud_eph_unbuddied_count;
-static unsigned long zbud_pers_unbuddied_count;
-static unsigned long zbud_eph_zombie_count;
-static unsigned long zbud_pers_zombie_count;
+static ssize_t zbud_eph_cumul_chunk_counts[NCHUNKS];
+static ssize_t zbud_pers_cumul_chunk_counts[NCHUNKS];
+static ssize_t zbud_eph_buddied_count;
+static ssize_t zbud_pers_buddied_count;
+static ssize_t zbud_eph_unbuddied_count;
+static ssize_t zbud_pers_unbuddied_count;
+static ssize_t zbud_eph_zombie_count;
+static ssize_t zbud_pers_zombie_count;
 static atomic_t zbud_eph_zombie_atomic;
 static atomic_t zbud_pers_zombie_atomic;
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/4] zcache/zbud: Fix __init mismatch
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
                             ` (2 preceding siblings ...)
  2013-02-15 17:53           ` [PATCH 3/4] zbud: " Konrad Rzeszutek Wilk
@ 2013-02-15 17:53           ` Konrad Rzeszutek Wilk
  2013-02-15 18:17           ` [PATCH] Compile bug-fixes to zcache (v4) Greg KH
  4 siblings, 0 replies; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-15 17:53 UTC (permalink / raw)
  To: devel, gregkh, linux-kernel; +Cc: sjenning, rcj, Konrad Rzeszutek Wilk

We get:
WARNING: drivers/staging/zcache/zcache.o(.text+0x13a1): Section mismatch
in reference from the function zcache_init() to the function
.init.text:zbud_init()
The function zcache_init() references
the function __init zbud_init().
This is often because zcache_init lacks a __init
annotation or the annotation of zbud_init is wrong.

And this fixes it.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/staging/zcache/zbud.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index 4654978..ee927e8 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -1047,7 +1047,7 @@ out:
 	return ret;
 }
 
-void __init zbud_init(void)
+void zbud_init(void)
 {
 	int i;
 
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH] Compile bug-fixes to zcache (v4).
  2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
                             ` (3 preceding siblings ...)
  2013-02-15 17:53           ` [PATCH 4/4] zcache/zbud: Fix __init mismatch Konrad Rzeszutek Wilk
@ 2013-02-15 18:17           ` Greg KH
  2013-02-15 18:48             ` Konrad Rzeszutek Wilk
  4 siblings, 1 reply; 30+ messages in thread
From: Greg KH @ 2013-02-15 18:17 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: devel, linux-kernel, sjenning, rcj

On Fri, Feb 15, 2013 at 12:53:40PM -0500, Konrad Rzeszutek Wilk wrote:
> > Then why not just redo that one patch, and send it to me, and then
> > rebase all of the other patches on top of it?  That way I can accept the
> > "fix the complier warnings" patch now, and the rest can wait.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Hey Greg,
> 
> Please see these four patches which fix compile warnings.
> 
> They are also available at
>  git://git.kernel.org/pub/scm/linux/kernel/git/konrad/mm.git stable/for-greg-3.9
> 
> if you prefer doing a git pull. The branch and this patchset are all
> based on git commit 0bcc0429bdb9f7cca3b7ab1f905b0d47031c03e0
> "staging: zcache: add TODO file"

Sorry, I don't do git pulls for staging drivers.

> Please pull or git am as you see fit.

All now applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Compile bug-fixes to zcache (v4).
  2013-02-15 18:17           ` [PATCH] Compile bug-fixes to zcache (v4) Greg KH
@ 2013-02-15 18:48             ` Konrad Rzeszutek Wilk
  2013-02-15 18:53               ` Greg KH
  0 siblings, 1 reply; 30+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-02-15 18:48 UTC (permalink / raw)
  To: Greg KH; +Cc: devel, linux-kernel, sjenning, rcj

> All now applied, thanks.

Much appreciated. What would be the best time to send you the patches for the 3.10
tree? About three weeks after the v3.9 merge window opens (or one week after -rc1 is cut?)
> 
> greg k-h

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Compile bug-fixes to zcache (v4).
  2013-02-15 18:48             ` Konrad Rzeszutek Wilk
@ 2013-02-15 18:53               ` Greg KH
  0 siblings, 0 replies; 30+ messages in thread
From: Greg KH @ 2013-02-15 18:53 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: devel, linux-kernel, sjenning, rcj

On Fri, Feb 15, 2013 at 01:48:06PM -0500, Konrad Rzeszutek Wilk wrote:
> > All now applied, thanks.
> 
> Much appreciated. What would be the best time to send you the patches
> for the 3.10 tree? About three weeks after the v3.9 merge window opens
> (or one week after -rc1 is cut?)

Either is fine, they probably will end up being applied at the same time :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2013-02-15 18:53 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<1360811106-2679-1-git-send-email-konrad.wilk@oracle.com>
2013-02-14 16:56 ` [PATCH] Various cleanups/fixes to zcache (v3) Dan Magenheimer
2013-02-14 16:59   ` Greg KH
2013-02-14 17:02     ` Dan Magenheimer
2013-02-14 17:29       ` Greg KH
2013-02-14 22:57         ` Konrad Rzeszutek Wilk
2013-02-15 17:53         ` [PATCH] Compile bug-fixes to zcache (v4) Konrad Rzeszutek Wilk
2013-02-15 17:53           ` [PATCH 1/4] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
2013-02-15 17:53           ` [PATCH 2/4] ramster: " Konrad Rzeszutek Wilk
2013-02-15 17:53           ` [PATCH 3/4] zbud: " Konrad Rzeszutek Wilk
2013-02-15 17:53           ` [PATCH 4/4] zcache/zbud: Fix __init mismatch Konrad Rzeszutek Wilk
2013-02-15 18:17           ` [PATCH] Compile bug-fixes to zcache (v4) Greg KH
2013-02-15 18:48             ` Konrad Rzeszutek Wilk
2013-02-15 18:53               ` Greg KH
2013-02-14  3:04 [PATCH] Various cleanups/fixes to zcache (v3) Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 01/16] zcache: s/int/bool/ on the various options Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 02/16] zcache: Provide accessory functions for counter increase Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 03/16] zcache: Provide accessory functions for counter decrease Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 04/16] zcache: The last of the atomic reads has now an accessory function Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 05/16] zcache: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 06/16] zcache: Make the debug code use pr_debug Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 07/16] zcache: Move debugfs code out of zcache-main.c file Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 08/16] zcache/debug: Use an array to initialize/use debugfs attributes Konrad Rzeszutek Wilk
2013-02-14  3:04 ` [PATCH 09/16] zcache: Move the last of the debugfs counters out Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 10/16] zcache: Module license is defined twice Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 11/16] zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 12/16] zcache/zbud: Fix compiler warnings Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 13/16] zcache/zbud: Add incremental accessory counters Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 14/16] zcache/zbud: Provide the accessory functions for counter decrease Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 15/16] ramster: Fix compile warnings due to usage of debugfs_create_size_t Konrad Rzeszutek Wilk
2013-02-14  3:05 ` [PATCH 16/16] zcache/zbud: Fix __init mismatch Konrad Rzeszutek Wilk

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).