[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1359751939-23584-5-git-send-email-konrad.wilk@oracle.com>
Date: Fri, 1 Feb 2013 15:52:07 -0500
From: Konrad Rzeszutek Wilk <konrad@...nel.org>
To: dan.magenheimer@...cle.com, konrad.wilk@...cle.com,
sjenning@...ux.vnet.ibm.com, gregkh@...uxfoundation.org,
rcj@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
devel@...verdev.osuosl.org
Subject: [PATCH 04/16] zcache: The last of the atomic reads has now an accessory function.
And now we can move the code to its own file.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.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 a55a95b..01da8f6 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -252,6 +252,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;
@@ -551,10 +559,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.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists