diff options
author | Mel Gorman <mel@csn.ul.ie> | 2010-05-24 17:32:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 11:06:59 -0400 |
commit | 748446bb6b5a9390b546af38ec899c868a9dbcf0 (patch) | |
tree | 4c27d0805a5e094b39ff938ad60dd270b953a79f /mm/migrate.c | |
parent | c175a0ce7584e5b498fff8cbdb9aa7912aa9fbba (diff) |
mm: compaction: memory compaction core
This patch is the core of a mechanism which compacts memory in a zone by
relocating movable pages towards the end of the zone.
A single compaction run involves a migration scanner and a free scanner.
Both scanners operate on pageblock-sized areas in the zone. The migration
scanner starts at the bottom of the zone and searches for all movable
pages within each area, isolating them onto a private list called
migratelist. The free scanner starts at the top of the zone and searches
for suitable areas and consumes the free pages within making them
available for the migration scanner. The pages isolated for migration are
then migrated to the newly isolated free pages.
[aarcange@redhat.com: Fix unsafe optimisation]
[mel@csn.ul.ie: do not schedule work on other CPUs for compaction]
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r-- | mm/migrate.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index 4afd6fe3c074..09e2471afa0f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -40,7 +40,8 @@ | |||
40 | 40 | ||
41 | /* | 41 | /* |
42 | * migrate_prep() needs to be called before we start compiling a list of pages | 42 | * migrate_prep() needs to be called before we start compiling a list of pages |
43 | * to be migrated using isolate_lru_page(). | 43 | * to be migrated using isolate_lru_page(). If scheduling work on other CPUs is |
44 | * undesirable, use migrate_prep_local() | ||
44 | */ | 45 | */ |
45 | int migrate_prep(void) | 46 | int migrate_prep(void) |
46 | { | 47 | { |
@@ -55,6 +56,14 @@ int migrate_prep(void) | |||
55 | return 0; | 56 | return 0; |
56 | } | 57 | } |
57 | 58 | ||
59 | /* Do the necessary work of migrate_prep but not if it involves other CPUs */ | ||
60 | int migrate_prep_local(void) | ||
61 | { | ||
62 | lru_add_drain(); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
58 | /* | 67 | /* |
59 | * Add isolated pages on the list back to the LRU under page lock | 68 | * Add isolated pages on the list back to the LRU under page lock |
60 | * to avoid leaking evictable pages back onto unevictable list. | 69 | * to avoid leaking evictable pages back onto unevictable list. |