mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	devel@driverdev.osuosl.org
Cc: dan.magenheimer@oracle.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 11/11] zcache/zbud: Add incremental accessory counters
Date: Mon,  4 Mar 2013 13:18:21 -0500	[thread overview]
Message-ID: <1362421101-15896-12-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1362421101-15896-1-git-send-email-konrad.wilk@oracle.com>

that are going to be used for debug fs entries.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
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 fdff5c6..0feb856 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


  parent reply	other threads:[~2013-03-04 18:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 18:18 [PATCH] Various fixes for zcache for v3.10 Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 01/11] zcache: s/int/bool/ on the various options Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 02/11] zcache: Provide accessory functions for counter increase Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 03/11] zcache: Provide accessory functions for counter decrease Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 04/11] zcache: The last of the atomic reads has now an accessory function Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 05/11] zcache: Make the debug code use pr_debug Konrad Rzeszutek Wilk
2013-03-04 18:28   ` Joe Perches
2013-03-05 21:54     ` Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 06/11] zcache: Move debugfs code out of zcache-main.c file Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 07/11] zcache/debug: Use an array to initialize/use debugfs attributes Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 08/11] zcache: Move the last of the debugfs counters out Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 09/11] zcache: Module license is defined twice Konrad Rzeszutek Wilk
2013-03-04 18:18 ` [PATCH 10/11] zcache/debug: Coalesce all debug under CONFIG_ZCACHE_DEBUG Konrad Rzeszutek Wilk
2013-03-04 18:18 ` Konrad Rzeszutek Wilk [this message]
2013-03-05  8:44   ` [PATCH 11/11] zcache/zbud: Add incremental accessory counters Greg KH
2013-03-05 14:02     ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362421101-15896-12-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®