aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/zcache/zcache-main.c
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-03-04 13:18:14 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-05 16:41:35 +0800
commite0d11aed1966df0858564b58d2e355d36ff38e06 (patch)
tree91971821c2bf173929c818e1a3d447b534509f8a /drivers/staging/zcache/zcache-main.c
parent6f4336fbbe666490b1dccb39b3c0499a051da09b (diff)
downloadlinux-e0d11aed1966df0858564b58d2e355d36ff38e06.tar.gz
zcache: The last of the atomic reads has now an accessory function.
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. Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/zcache/zcache-main.c')
-rw-r--r--drivers/staging/zcache/zcache-main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 4272ab9c29f..f455151377a 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 ssize_t zcache_flush_total;
static ssize_t 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)