Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753770Ab3COCfo (ORCPT ); Thu, 14 Mar 2013 22:35:44 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:43235 "EHLO e23smtp09.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753729Ab3COCfm (ORCPT ); Thu, 14 Mar 2013 22:35:42 -0400 From: Wanpeng Li To: Greg Kroah-Hartman , Andrew Morton Cc: Dan Magenheimer , Seth Jennings , Konrad Rzeszutek Wilk , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH v3 3/5] handle zcache_[eph|pers]_zpages for zero-filled page Date: Fri, 15 Mar 2013 10:34:18 +0800 Message-Id: <1363314860-22731-4-git-send-email-liwanp@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1363314860-22731-1-git-send-email-liwanp@linux.vnet.ibm.com> References: <1363314860-22731-1-git-send-email-liwanp@linux.vnet.ibm.com> x-cbid: 13031502-3568-0000-0000-0000034AE730 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1715 Lines: 48 Increment/decrement zcache_[eph|pers]_zpages for zero-filled pages, the main point of the counters for zpages and pageframes is to be able to calculate density == zpages/pageframes. A zero-filled page becomes a zpage that "compresses" to zero bytes and, as a result, requires zero pageframes for storage. So the zpages counter should be increased but the pageframes counter should not. [Dan Magenheimer : patch description] Acked-by: Dan Magenheimer Signed-off-by: Wanpeng Li --- drivers/staging/zcache/zcache-main.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 6c35c7d..ef8c960 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -863,6 +863,8 @@ static int zcache_pampd_get_data_and_free(char *data, size_t *sizep, bool raw, if (pampd == (void *)ZERO_FILLED) { handle_zero_filled_page(data); zero_filled = true; + zsize = 0; + zpages = 1; if (!raw) *sizep = PAGE_SIZE; goto zero_fill; @@ -917,8 +919,11 @@ static void zcache_pampd_free(void *pampd, struct tmem_pool *pool, BUG_ON(preemptible()); - if (pampd == (void *)ZERO_FILLED) + if (pampd == (void *)ZERO_FILLED) { zero_filled = true; + zsize = 0; + zpages = 1; + } if (pampd_is_remote(pampd) && !zero_filled) { -- 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/