Skip to contentSkip to conversation

CMA: decrease cc.nr_migratepages after reclaiming pagelist

PATCH In review Minchan Kim 2 participants 2 messages Sep 26, 2012 – Sep 28, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CMA: decrease cc.nr_migratepages after reclaiming pagelist

The reclaim_clean_pages_from_list reclaims clean pages before migration so cc.nr_migratepages should be updated. Currently, there is no problem but it can be wrong if we try to use the vaule in future.

Cc Mel Gorman <[email protected]>
Cc Michal Nazarewicz <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Marek Szyprowski <[email protected]>

---
I found this problem during I develop new feature. :(

 mm/page_alloc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
mm/page_alloc.c +4 -2
index 296bea9..4b7dced 100644
@@ -5669,7 +5669,7 @@ static unsigned long pfn_max_align_up(unsigned long pfn)
 static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
 {
 	/* This function is based on compact_zone() from compaction.c. */
-
+	unsigned long nr_reclaimed;
 	unsigned long pfn = start;
 	unsigned int tries = 0;
 	int ret = 0;
@@ -5705,7 +5705,9 @@ static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
 			break;
 		}
 
-		reclaim_clean_pages_from_list(cc.zone, &cc.migratepages);
+		nr_reclaimed = reclaim_clean_pages_from_list(cc.zone,
+							&cc.migratepages);
+		cc.nr_migratepages -= nr_reclaimed;
 
 		ret = migrate_pages(&cc.migratepages,
 				    alloc_migrate_target,
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Minchan Kim

The reclaim_clean_pages_from_list reclaims clean pages before migration so cc.nr_migratepages should be updated. Currently, there is no problem but it can be wrong if we try to use the vaule in future.

Cc Mel Gorman <[email protected]>
Cc Michal Nazarewicz <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Marek Szyprowski <[email protected]>

Yeah ok. As you say, it shouldn't actually affect anything currently and cc.migratepages is expected to go out of date after migration meaning we need update_nr_listpages. This patch looks ok though.

Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>