Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932570Ab2KEOuf (ORCPT ); Mon, 5 Nov 2012 09:50:35 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:34449 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751606Ab2KEOue (ORCPT ); Mon, 5 Nov 2012 09:50:34 -0500 From: Konrad Rzeszutek Wilk To: linux-kernel@vger.kernel.org, sjenning@linux.vnet.ibm.com, dan.magenheimer@oracle.com, ngupta@vflare.org, minchan@kernel.org, rcj@linux.vnet.ibm.com, linux-mm@kvack.org, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org Cc: akpm@linux-foundation.org, Konrad Rzeszutek Wilk Subject: [PATCH 05/11] zcache: The last of the atomic reads has now an accessory function. Date: Mon, 5 Nov 2012 09:37:28 -0500 Message-Id: <1352126254-28933-6-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1352126254-28933-1-git-send-email-konrad.wilk@oracle.com> References: <1352126254-28933-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1735 Lines: 45 And now we can move the code to its own file. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/staging/ramster/zcache-main.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ramster/zcache-main.c b/drivers/staging/ramster/zcache-main.c index 29ffbf1..3402acc 100644 --- a/drivers/staging/ramster/zcache-main.c +++ b/drivers/staging/ramster/zcache-main.c @@ -250,6 +250,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; @@ -549,10 +557,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.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/