diff options
author | Jan Beulich <JBeulich@novell.com> | 2009-09-21 20:03:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:38 -0400 |
commit | 4481374ce88ba8f460c8b89f2572027bd27057d0 (patch) | |
tree | 6896601b6a1da0e3e932ffa75fcff966c834c02c /mm | |
parent | 4738e1b9cf8f9e28d7de080a5e6ce5d0095ea18f (diff) |
mm: replace various uses of num_physpages by totalram_pages
Sizing of memory allocations shouldn't depend on the number of physical
pages found in a system, as that generally includes (perhaps a huge amount
of) non-RAM pages. The amount of what actually is usable as storage
should instead be used as a basis here.
Some of the calculations (i.e. those not intending to use high memory)
should likely even use (totalram_pages - totalhigh_pages).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Dave Airlie <airlied@linux.ie>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 2 | ||||
-rw-r--r-- | mm/swap.c | 2 | ||||
-rw-r--r-- | mm/vmalloc.c | 4 |
3 files changed, 4 insertions, 4 deletions
@@ -1384,7 +1384,7 @@ void __init kmem_cache_init(void) | |||
1384 | * Fragmentation resistance on low memory - only use bigger | 1384 | * Fragmentation resistance on low memory - only use bigger |
1385 | * page orders on machines with more than 32MB of memory. | 1385 | * page orders on machines with more than 32MB of memory. |
1386 | */ | 1386 | */ |
1387 | if (num_physpages > (32 << 20) >> PAGE_SHIFT) | 1387 | if (totalram_pages > (32 << 20) >> PAGE_SHIFT) |
1388 | slab_break_gfp_order = BREAK_GFP_ORDER_HI; | 1388 | slab_break_gfp_order = BREAK_GFP_ORDER_HI; |
1389 | 1389 | ||
1390 | /* Bootstrap is tricky, because several objects are allocated | 1390 | /* Bootstrap is tricky, because several objects are allocated |
@@ -496,7 +496,7 @@ EXPORT_SYMBOL(pagevec_lookup_tag); | |||
496 | */ | 496 | */ |
497 | void __init swap_setup(void) | 497 | void __init swap_setup(void) |
498 | { | 498 | { |
499 | unsigned long megs = num_physpages >> (20 - PAGE_SHIFT); | 499 | unsigned long megs = totalram_pages >> (20 - PAGE_SHIFT); |
500 | 500 | ||
501 | #ifdef CONFIG_SWAP | 501 | #ifdef CONFIG_SWAP |
502 | bdi_init(swapper_space.backing_dev_info); | 502 | bdi_init(swapper_space.backing_dev_info); |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 9216b2555d07..5535da1d6961 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1386,7 +1386,7 @@ void *vmap(struct page **pages, unsigned int count, | |||
1386 | 1386 | ||
1387 | might_sleep(); | 1387 | might_sleep(); |
1388 | 1388 | ||
1389 | if (count > num_physpages) | 1389 | if (count > totalram_pages) |
1390 | return NULL; | 1390 | return NULL; |
1391 | 1391 | ||
1392 | area = get_vm_area_caller((count << PAGE_SHIFT), flags, | 1392 | area = get_vm_area_caller((count << PAGE_SHIFT), flags, |
@@ -1493,7 +1493,7 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot, | |||
1493 | unsigned long real_size = size; | 1493 | unsigned long real_size = size; |
1494 | 1494 | ||
1495 | size = PAGE_ALIGN(size); | 1495 | size = PAGE_ALIGN(size); |
1496 | if (!size || (size >> PAGE_SHIFT) > num_physpages) | 1496 | if (!size || (size >> PAGE_SHIFT) > totalram_pages) |
1497 | return NULL; | 1497 | return NULL; |
1498 | 1498 | ||
1499 | area = __get_vm_area_node(size, VM_ALLOC, VMALLOC_START, VMALLOC_END, | 1499 | area = __get_vm_area_node(size, VM_ALLOC, VMALLOC_START, VMALLOC_END, |