aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2007-10-16 04:26:11 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:02 -0400
commita5d76b54a3f3a40385d7f76069a2feac9f1bad63 (patch)
treef58c432a4224b3be032bd4a4afa79dfa55d198a6 /mm/page_alloc.c
parent75884fb1c6388f3713ddcca662f3647b3129aaeb (diff)
memory unplug: page isolation
Implement generic chunk-of-pages isolation method by using page grouping ops. This patch add MIGRATE_ISOLATE to MIGRATE_TYPES. By this - MIGRATE_TYPES increases. - bitmap for migratetype is enlarged. pages of MIGRATE_ISOLATE migratetype will not be allocated even if it is free. By this, you can isolated *freed* pages from users. How-to-free pages is not a purpose of this patch. You may use reclaim and migrate codes to free pages. If start_isolate_page_range(start,end) is called, - migratetype of the range turns to be MIGRATE_ISOLATE if its type is MIGRATE_MOVABLE. (*) this check can be updated if other memory reclaiming works make progress. - MIGRATE_ISOLATE is not on migratetype fallback list. - All free pages and will-be-freed pages are isolated. To check all pages in the range are isolated or not, use test_pages_isolated(), To cancel isolation, use undo_isolate_page_range(). Changes V6 -> V7 - removed unnecessary #ifdef There are HOLES_IN_ZONE handling codes...I'm glad if we can remove them.. Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> Signed-off-by: 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/page_alloc.c')
-rw-r--r--mm/page_alloc.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 71ced519c31c..a44715e82058 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -41,6 +41,7 @@
41#include <linux/pfn.h> 41#include <linux/pfn.h>
42#include <linux/backing-dev.h> 42#include <linux/backing-dev.h>
43#include <linux/fault-inject.h> 43#include <linux/fault-inject.h>
44#include <linux/page-isolation.h>
44 45
45#include <asm/tlbflush.h> 46#include <asm/tlbflush.h>
46#include <asm/div64.h> 47#include <asm/div64.h>
@@ -4433,3 +4434,46 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
4433 else 4434 else
4434 __clear_bit(bitidx + start_bitidx, bitmap); 4435 __clear_bit(bitidx + start_bitidx, bitmap);
4435} 4436}
4437
4438/*
4439 * This is designed as sub function...plz see page_isolation.c also.
4440 * set/clear page block's type to be ISOLATE.
4441 * page allocater never alloc memory from ISOLATE block.
4442 */
4443
4444int set_migratetype_isolate(struct page *page)
4445{
4446 struct zone *zone;
4447 unsigned long flags;
4448 int ret = -EBUSY;
4449
4450 zone = page_zone(page);
4451 spin_lock_irqsave(&zone->lock, flags);
4452 /*
4453 * In future, more migrate types will be able to be isolation target.
4454 */
4455 if (get_pageblock_migratetype(page) != MIGRATE_MOVABLE)
4456 goto out;
4457 set_pageblock_migratetype(page, MIGRATE_ISOLATE);
4458 move_freepages_block(zone, page, MIGRATE_ISOLATE);
4459 ret = 0;
4460out:
4461 spin_unlock_irqrestore(&zone->lock, flags);
4462 if (!ret)
4463 drain_all_local_pages();
4464 return ret;
4465}
4466
4467void unset_migratetype_isolate(struct page *page)
4468{
4469 struct zone *zone;
4470 unsigned long flags;
4471 zone = page_zone(page);
4472 spin_lock_irqsave(&zone->lock, flags);
4473 if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
4474 goto out;
4475 set_pageblock_migratetype(page, MIGRATE_MOVABLE);
4476 move_freepages_block(zone, page, MIGRATE_MOVABLE);
4477out:
4478 spin_unlock_irqrestore(&zone->lock, flags);
4479}