[PATCH] mm: Fixup the condition whether the page cache is free

From: Haifeng Li
Date: Sun Mar 03 2013 - 20:42:53 EST


When a page is allocated, its reference is 1. If the page is
inserted into page cache tree, the referenced also should be
increased by 1. In reclaiming routine, it also referenced by
isolated list. So here, the condition whether the page is free
should be 3.

Signed-off-by: Haifeng Li <omycle@xxxxxxxxx>
---
mm/vmscan.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 6759993..b588378 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -400,11 +400,12 @@ static void reset_reclaim_mode(struct scan_control *sc)
static inline int is_page_cache_freeable(struct page *page)
{
/*
- * A freeable page cache page is referenced only by the caller
- * that isolated the page, the page cache radix tree and
- * optional buffer heads at page->private.
+ * A freeable page cache page, _count of which is
+ * initialized by 1. And it is also referenced only
+ * by the caller that isolated the page, the page cache
+ * radix tree and optional buffer heads at page->private.
*/
- return page_count(page) - page_has_private(page) == 2;
+ return page_count(page) - page_has_private(page) == 3;
}

static int may_write_to_queue(struct backing_dev_info *bdi,
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/