From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932340Ab3BNDHX (ORCPT ); Wed, 13 Feb 2013 22:07:23 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:47999 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754705Ab3BNDFS (ORCPT ); Wed, 13 Feb 2013 22:05:18 -0500 From: Konrad Rzeszutek Wilk To: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, dan.magenheimer@oracle.com, gregkh@linuxfoundation.org Cc: sjenning@linux.vnet.ibm.com, rcj@linux.vnet.ibm.com, Konrad Rzeszutek Wilk Subject: [PATCH 04/16] zcache: The last of the atomic reads has now an accessory function. Date: Wed, 13 Feb 2013 22:04:54 -0500 Message-Id: <1360811106-2679-5-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1360811106-2679-1-git-send-email-konrad.wilk@oracle.com> References: <1360811106-2679-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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