aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2007-07-17 07:03:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:22:59 -0400
commit769848c03895b63e5662eb7e4ec8c4866f7d0183 (patch)
tree8911c7c312c8b8b172795fa2874c8162e1d3d15a /mm/memory.c
parenta32ea1e1f925399e0d81ca3f7394a44a6dafa12c (diff)
Add __GFP_MOVABLE for callers to flag allocations from high memory that may be migrated
It is often known at allocation time whether a page may be migrated or not. This patch adds a flag called __GFP_MOVABLE and a new mask called GFP_HIGH_MOVABLE. Allocations using the __GFP_MOVABLE can be either migrated using the page migration mechanism or reclaimed by syncing with backing storage and discarding. An API function very similar to alloc_zeroed_user_highpage() is added for __GFP_MOVABLE allocations called alloc_zeroed_user_highpage_movable(). The flags used by alloc_zeroed_user_highpage() are not changed because it would change the semantics of an existing API. After this patch is applied there are no in-kernel users of alloc_zeroed_user_highpage() so it probably should be marked deprecated if this patch is merged. Note that this patch includes a minor cleanup to the use of __GFP_ZERO in shmem.c to keep all flag modifications to inode->mapping in the shmem_dir_alloc() helper function. This clean-up suggestion is courtesy of Hugh Dickens. Additional credit goes to Christoph Lameter and Linus Torvalds for shaping the concept. Credit to Hugh Dickens for catching issues with shmem swap vector and ramfs allocations. [akpm@linux-foundation.org: build fix] [hugh@veritas.com: __GFP_ZERO cleanup] Signed-off-by: Mel Gorman <mel@csn.ul.ie> Cc: Andy Whitcroft <apw@shadowen.org> Cc: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/memory.c b/mm/memory.c
index b3d73bb1f680..9c6ff7fffdc8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1715,11 +1715,11 @@ gotten:
1715 if (unlikely(anon_vma_prepare(vma))) 1715 if (unlikely(anon_vma_prepare(vma)))
1716 goto oom; 1716 goto oom;
1717 if (old_page == ZERO_PAGE(address)) { 1717 if (old_page == ZERO_PAGE(address)) {
1718 new_page = alloc_zeroed_user_highpage(vma, address); 1718 new_page = alloc_zeroed_user_highpage_movable(vma, address);
1719 if (!new_page) 1719 if (!new_page)
1720 goto oom; 1720 goto oom;
1721 } else { 1721 } else {
1722 new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); 1722 new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
1723 if (!new_page) 1723 if (!new_page)
1724 goto oom; 1724 goto oom;
1725 cow_user_page(new_page, old_page, address, vma); 1725 cow_user_page(new_page, old_page, address, vma);
@@ -2237,7 +2237,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
2237 2237
2238 if (unlikely(anon_vma_prepare(vma))) 2238 if (unlikely(anon_vma_prepare(vma)))
2239 goto oom; 2239 goto oom;
2240 page = alloc_zeroed_user_highpage(vma, address); 2240 page = alloc_zeroed_user_highpage_movable(vma, address);
2241 if (!page) 2241 if (!page)
2242 goto oom; 2242 goto oom;
2243 2243
@@ -2340,7 +2340,8 @@ retry:
2340 2340
2341 if (unlikely(anon_vma_prepare(vma))) 2341 if (unlikely(anon_vma_prepare(vma)))
2342 goto oom; 2342 goto oom;
2343 page = alloc_page_vma(GFP_HIGHUSER, vma, address); 2343 page = alloc_page_vma(GFP_HIGHUSER_MOVABLE,
2344 vma, address);
2344 if (!page) 2345 if (!page)
2345 goto oom; 2346 goto oom;
2346 copy_user_highpage(page, new_page, address, vma); 2347 copy_user_highpage(page, new_page, address, vma);