Add __GFP_MOVABLE for callers to flag allocations from high memory that may be migrated
authorMel Gorman <mel@csn.ul.ie>
Tue, 17 Jul 2007 11:03:05 +0000 (04:03 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 17:22:59 +0000 (10:22 -0700)
commit769848c03895b63e5662eb7e4ec8c4866f7d0183
tree8911c7c312c8b8b172795fa2874c8162e1d3d15a
parenta32ea1e1f925399e0d81ca3f7394a44a6dafa12c
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>
19 files changed:
fs/buffer.c
fs/inode.c
fs/ramfs/inode.c
include/asm-alpha/page.h
include/asm-cris/page.h
include/asm-h8300/page.h
include/asm-i386/page.h
include/asm-ia64/page.h
include/asm-m32r/page.h
include/asm-m68knommu/page.h
include/asm-s390/page.h
include/asm-x86_64/page.h
include/linux/gfp.h
include/linux/highmem.h
mm/memory.c
mm/mempolicy.c
mm/migrate.c
mm/shmem.c
mm/swap_state.c