All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Refactor zone_reclaim code (v4)
@ 2011-01-25  5:10 ` Balbir Singh
  0 siblings, 0 replies; 47+ messages in thread
From: Balbir Singh @ 2011-01-25  5:10 UTC (permalink / raw)
  To: linux-mm, akpm
  Cc: npiggin, kvm, linux-kernel, kosaki.motohiro, cl, kamezawa.hiroyu

Changelog v3
1. Renamed zone_reclaim_unmapped_pages to zone_reclaim_pages

Refactor zone_reclaim, move reusable functionality outside
of zone_reclaim. Make zone_reclaim_unmapped_pages modular

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
---
 mm/vmscan.c |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5899f2f..02cc82e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2943,6 +2943,27 @@ static long zone_pagecache_reclaimable(struct zone *zone)
 }
 
 /*
+ * Helper function to reclaim unmapped pages, we might add something
+ * similar to this for slab cache as well. Currently this function
+ * is shared with __zone_reclaim()
+ */
+static inline void
+zone_reclaim_pages(struct zone *zone, struct scan_control *sc,
+				unsigned long nr_pages)
+{
+	int priority;
+	/*
+	 * Free memory by calling shrink zone with increasing
+	 * priorities until we have enough memory freed.
+	 */
+	priority = ZONE_RECLAIM_PRIORITY;
+	do {
+		shrink_zone(priority, zone, sc);
+		priority--;
+	} while (priority >= 0 && sc->nr_reclaimed < nr_pages);
+}
+
+/*
  * Try to free up some pages from this zone through reclaim.
  */
 static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
@@ -2951,7 +2972,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
 	const unsigned long nr_pages = 1 << order;
 	struct task_struct *p = current;
 	struct reclaim_state reclaim_state;
-	int priority;
 	struct scan_control sc = {
 		.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
 		.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
@@ -2975,17 +2995,8 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
 	reclaim_state.reclaimed_slab = 0;
 	p->reclaim_state = &reclaim_state;
 
-	if (zone_pagecache_reclaimable(zone) > zone->min_unmapped_pages) {
-		/*
-		 * Free memory by calling shrink zone with increasing
-		 * priorities until we have enough memory freed.
-		 */
-		priority = ZONE_RECLAIM_PRIORITY;
-		do {
-			shrink_zone(priority, zone, &sc);
-			priority--;
-		} while (priority >= 0 && sc.nr_reclaimed < nr_pages);
-	}
+	if (zone_pagecache_reclaimable(zone) > zone->min_unmapped_pages)
+		zone_reclaim_pages(zone, &sc, nr_pages);
 
 	nr_slab_pages0 = zone_page_state(zone, NR_SLAB_RECLAIMABLE);
 	if (nr_slab_pages0 > zone->min_slab_pages) {


^ permalink raw reply related	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2011-02-16 23:45 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25  5:10 [PATCH 1/2] Refactor zone_reclaim code (v4) Balbir Singh
2011-01-25  5:10 ` Balbir Singh
2011-01-25  5:10 ` [PATCH 3/3] Provide control over unmapped pages (v4) Balbir Singh
2011-01-25  5:10   ` Balbir Singh
2011-01-26 16:57   ` Christoph Lameter
2011-01-26 16:57     ` Christoph Lameter
2011-01-26 17:43     ` Balbir Singh
2011-01-26 17:43       ` Balbir Singh
2011-01-26 23:12   ` Minchan Kim
2011-01-26 23:12     ` Minchan Kim
2011-01-28  2:56     ` Balbir Singh
2011-01-28  2:56       ` Balbir Singh
2011-01-28  5:44       ` Minchan Kim
2011-01-28  5:44         ` Minchan Kim
2011-01-28  6:48         ` Balbir Singh
2011-01-28  6:48           ` Balbir Singh
2011-01-28  6:48           ` Balbir Singh
2011-01-28  7:24           ` Minchan Kim
2011-01-28  7:24             ` Minchan Kim
2011-01-28  7:56             ` KAMEZAWA Hiroyuki
2011-01-28  7:56               ` KAMEZAWA Hiroyuki
2011-01-28  7:56               ` KAMEZAWA Hiroyuki
2011-01-28  8:19               ` Balbir Singh
2011-01-28  8:19                 ` Balbir Singh
2011-01-28  8:19                 ` Balbir Singh
2011-01-28  8:17                 ` KAMEZAWA Hiroyuki
2011-01-28  8:17                   ` KAMEZAWA Hiroyuki
2011-01-28 12:02                   ` Balbir Singh
2011-01-28 12:02                     ` Balbir Singh
2011-01-28 15:20               ` Christoph Lameter
2011-01-28 15:20                 ` Christoph Lameter
2011-01-30 23:58                 ` KAMEZAWA Hiroyuki
2011-01-30 23:58                   ` KAMEZAWA Hiroyuki
2011-01-31  4:37                   ` Balbir Singh
2011-01-31  4:37                     ` Balbir Singh
2011-01-28 11:18             ` Balbir Singh
2011-01-28 11:18               ` Balbir Singh
2011-02-10  5:33               ` Minchan Kim
2011-02-10  5:33                 ` Minchan Kim
2011-02-10  5:41                 ` Minchan Kim
2011-02-10  5:41                   ` Minchan Kim
2011-02-13 17:33                   ` Balbir Singh
2011-02-13 17:33                     ` Balbir Singh
2011-02-16 23:45                     ` Minchan Kim
2011-02-16 23:45                       ` Minchan Kim
2011-01-25  5:15 ` [PATCH 1/2] Refactor zone_reclaim code (v4) Balbir Singh
2011-01-25  5:15   ` Balbir Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.