aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@novell.com>2009-09-21 20:03:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:38 -0400
commit4481374ce88ba8f460c8b89f2572027bd27057d0 (patch)
tree6896601b6a1da0e3e932ffa75fcff966c834c02c
parent4738e1b9cf8f9e28d7de080a5e6ce5d0095ea18f (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>
-rw-r--r--arch/x86/kernel/microcode_core.c4
-rw-r--r--drivers/char/agp/backend.c4
-rw-r--r--drivers/parisc/ccio-dma.c4
-rw-r--r--drivers/parisc/sba_iommu.c4
-rw-r--r--drivers/xen/balloon.c4
-rw-r--r--fs/ntfs/malloc.h2
-rw-r--r--include/linux/mm.h1
-rw-r--r--init/main.c4
-rw-r--r--mm/slab.c2
-rw-r--r--mm/swap.c2
-rw-r--r--mm/vmalloc.c4
-rw-r--r--net/core/sock.c4
-rw-r--r--net/dccp/proto.c6
-rw-r--r--net/decnet/dn_route.c2
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/netfilter/nf_conntrack_core.c4
-rw-r--r--net/netfilter/x_tables.c2
-rw-r--r--net/netfilter/xt_hashlimit.c8
-rw-r--r--net/netlink/af_netlink.c6
-rw-r--r--net/sctp/protocol.c6
21 files changed, 38 insertions, 41 deletions
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 0db7969b0dde..378e9a8f1bf8 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -210,8 +210,8 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
210{ 210{
211 ssize_t ret = -EINVAL; 211 ssize_t ret = -EINVAL;
212 212
213 if ((len >> PAGE_SHIFT) > num_physpages) { 213 if ((len >> PAGE_SHIFT) > totalram_pages) {
214 pr_err("microcode: too much data (max %ld pages)\n", num_physpages); 214 pr_err("microcode: too much data (max %ld pages)\n", totalram_pages);
215 return ret; 215 return ret;
216 } 216 }
217 217
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index ad87753f6de4..a56ca080e108 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -114,9 +114,9 @@ static int agp_find_max(void)
114 long memory, index, result; 114 long memory, index, result;
115 115
116#if PAGE_SHIFT < 20 116#if PAGE_SHIFT < 20
117 memory = num_physpages >> (20 - PAGE_SHIFT); 117 memory = totalram_pages >> (20 - PAGE_SHIFT);
118#else 118#else
119 memory = num_physpages << (PAGE_SHIFT - 20); 119 memory = totalram_pages << (PAGE_SHIFT - 20);
120#endif 120#endif
121 index = 1; 121 index = 1;
122 122
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index a45b0c0d574e..a6b4a5a53d40 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1266,7 +1266,7 @@ ccio_ioc_init(struct ioc *ioc)
1266 ** Hot-Plug/Removal of PCI cards. (aka PCI OLARD). 1266 ** Hot-Plug/Removal of PCI cards. (aka PCI OLARD).
1267 */ 1267 */
1268 1268
1269 iova_space_size = (u32) (num_physpages / count_parisc_driver(&ccio_driver)); 1269 iova_space_size = (u32) (totalram_pages / count_parisc_driver(&ccio_driver));
1270 1270
1271 /* limit IOVA space size to 1MB-1GB */ 1271 /* limit IOVA space size to 1MB-1GB */
1272 1272
@@ -1305,7 +1305,7 @@ ccio_ioc_init(struct ioc *ioc)
1305 1305
1306 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", 1306 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n",
1307 __func__, ioc->ioc_regs, 1307 __func__, ioc->ioc_regs,
1308 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1308 (unsigned long) totalram_pages >> (20 - PAGE_SHIFT),
1309 iova_space_size>>20, 1309 iova_space_size>>20,
1310 iov_order + PAGE_SHIFT); 1310 iov_order + PAGE_SHIFT);
1311 1311
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 123d8fe3427d..57a6d19eba4c 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -1390,7 +1390,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1390 ** for DMA hints - ergo only 30 bits max. 1390 ** for DMA hints - ergo only 30 bits max.
1391 */ 1391 */
1392 1392
1393 iova_space_size = (u32) (num_physpages/global_ioc_cnt); 1393 iova_space_size = (u32) (totalram_pages/global_ioc_cnt);
1394 1394
1395 /* limit IOVA space size to 1MB-1GB */ 1395 /* limit IOVA space size to 1MB-1GB */
1396 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) { 1396 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {
@@ -1415,7 +1415,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1415 DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", 1415 DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",
1416 __func__, 1416 __func__,
1417 ioc->ioc_hpa, 1417 ioc->ioc_hpa,
1418 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1418 (unsigned long) totalram_pages >> (20 - PAGE_SHIFT),
1419 iova_space_size>>20, 1419 iova_space_size>>20,
1420 iov_order + PAGE_SHIFT); 1420 iov_order + PAGE_SHIFT);
1421 1421
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index f5bbd9e83416..1b7123eb5d7b 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -96,11 +96,7 @@ static struct balloon_stats balloon_stats;
96/* We increase/decrease in batches which fit in a page */ 96/* We increase/decrease in batches which fit in a page */
97static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)]; 97static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
98 98
99/* VM /proc information for memory */
100extern unsigned long totalram_pages;
101
102#ifdef CONFIG_HIGHMEM 99#ifdef CONFIG_HIGHMEM
103extern unsigned long totalhigh_pages;
104#define inc_totalhigh_pages() (totalhigh_pages++) 100#define inc_totalhigh_pages() (totalhigh_pages++)
105#define dec_totalhigh_pages() (totalhigh_pages--) 101#define dec_totalhigh_pages() (totalhigh_pages--)
106#else 102#else
diff --git a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h
index cd0be3f5c3cd..a44b14cbceeb 100644
--- a/fs/ntfs/malloc.h
+++ b/fs/ntfs/malloc.h
@@ -47,7 +47,7 @@ static inline void *__ntfs_malloc(unsigned long size, gfp_t gfp_mask)
47 return kmalloc(PAGE_SIZE, gfp_mask & ~__GFP_HIGHMEM); 47 return kmalloc(PAGE_SIZE, gfp_mask & ~__GFP_HIGHMEM);
48 /* return (void *)__get_free_page(gfp_mask); */ 48 /* return (void *)__get_free_page(gfp_mask); */
49 } 49 }
50 if (likely(size >> PAGE_SHIFT < num_physpages)) 50 if (likely((size >> PAGE_SHIFT) < totalram_pages))
51 return __vmalloc(size, gfp_mask, PAGE_KERNEL); 51 return __vmalloc(size, gfp_mask, PAGE_KERNEL);
52 return NULL; 52 return NULL;
53} 53}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d808cf832c4d..19ff81c49ba6 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,6 +25,7 @@ extern unsigned long max_mapnr;
25#endif 25#endif
26 26
27extern unsigned long num_physpages; 27extern unsigned long num_physpages;
28extern unsigned long totalram_pages;
28extern void * high_memory; 29extern void * high_memory;
29extern int page_cluster; 30extern int page_cluster;
30 31
diff --git a/init/main.c b/init/main.c
index 34971becbd3c..2c48c3153163 100644
--- a/init/main.c
+++ b/init/main.c
@@ -668,12 +668,12 @@ asmlinkage void __init start_kernel(void)
668#endif 668#endif
669 thread_info_cache_init(); 669 thread_info_cache_init();
670 cred_init(); 670 cred_init();
671 fork_init(num_physpages); 671 fork_init(totalram_pages);
672 proc_caches_init(); 672 proc_caches_init();
673 buffer_init(); 673 buffer_init();
674 key_init(); 674 key_init();
675 security_init(); 675 security_init();
676 vfs_caches_init(num_physpages); 676 vfs_caches_init(totalram_pages);
677 radix_tree_init(); 677 radix_tree_init();
678 signals_init(); 678 signals_init();
679 /* rootfs populating might need page-writeback */ 679 /* rootfs populating might need page-writeback */
diff --git a/mm/slab.c b/mm/slab.c
index 7b5d4deacfcd..7dfa481c96ba 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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
diff --git a/mm/swap.c b/mm/swap.c
index 4a8a59e671f7..308e57d8d7ed 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -496,7 +496,7 @@ EXPORT_SYMBOL(pagevec_lookup_tag);
496 */ 496 */
497void __init swap_setup(void) 497void __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,
diff --git a/net/core/sock.c b/net/core/sock.c
index 30d5446512f9..524712a7b154 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1206,12 +1206,12 @@ EXPORT_SYMBOL_GPL(sk_setup_caps);
1206 1206
1207void __init sk_init(void) 1207void __init sk_init(void)
1208{ 1208{
1209 if (num_physpages <= 4096) { 1209 if (totalram_pages <= 4096) {
1210 sysctl_wmem_max = 32767; 1210 sysctl_wmem_max = 32767;
1211 sysctl_rmem_max = 32767; 1211 sysctl_rmem_max = 32767;
1212 sysctl_wmem_default = 32767; 1212 sysctl_wmem_default = 32767;
1213 sysctl_rmem_default = 32767; 1213 sysctl_rmem_default = 32767;
1214 } else if (num_physpages >= 131072) { 1214 } else if (totalram_pages >= 131072) {
1215 sysctl_wmem_max = 131071; 1215 sysctl_wmem_max = 131071;
1216 sysctl_rmem_max = 131071; 1216 sysctl_rmem_max = 131071;
1217 } 1217 }
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 923db06c7e55..bc4467082a00 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1049,10 +1049,10 @@ static int __init dccp_init(void)
1049 * 1049 *
1050 * The methodology is similar to that of the buffer cache. 1050 * The methodology is similar to that of the buffer cache.
1051 */ 1051 */
1052 if (num_physpages >= (128 * 1024)) 1052 if (totalram_pages >= (128 * 1024))
1053 goal = num_physpages >> (21 - PAGE_SHIFT); 1053 goal = totalram_pages >> (21 - PAGE_SHIFT);
1054 else 1054 else
1055 goal = num_physpages >> (23 - PAGE_SHIFT); 1055 goal = totalram_pages >> (23 - PAGE_SHIFT);
1056 1056
1057 if (thash_entries) 1057 if (thash_entries)
1058 goal = (thash_entries * 1058 goal = (thash_entries *
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 9383d3e5a1ab..57662cabaf9b 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1750,7 +1750,7 @@ void __init dn_route_init(void)
1750 dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; 1750 dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ;
1751 add_timer(&dn_route_timer); 1751 add_timer(&dn_route_timer);
1752 1752
1753 goal = num_physpages >> (26 - PAGE_SHIFT); 1753 goal = totalram_pages >> (26 - PAGE_SHIFT);
1754 1754
1755 for(order = 0; (1UL << order) < goal; order++) 1755 for(order = 0; (1UL << order) < goal; order++)
1756 /* NOTHING */; 1756 /* NOTHING */;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 91867d3e6328..df9347314538 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3414,7 +3414,7 @@ int __init ip_rt_init(void)
3414 alloc_large_system_hash("IP route cache", 3414 alloc_large_system_hash("IP route cache",
3415 sizeof(struct rt_hash_bucket), 3415 sizeof(struct rt_hash_bucket),
3416 rhash_entries, 3416 rhash_entries,
3417 (num_physpages >= 128 * 1024) ? 3417 (totalram_pages >= 128 * 1024) ?
3418 15 : 17, 3418 15 : 17,
3419 0, 3419 0,
3420 &rt_hash_log, 3420 &rt_hash_log,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 19a0612b8a20..21387ebabf00 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2862,7 +2862,7 @@ void __init tcp_init(void)
2862 alloc_large_system_hash("TCP established", 2862 alloc_large_system_hash("TCP established",
2863 sizeof(struct inet_ehash_bucket), 2863 sizeof(struct inet_ehash_bucket),
2864 thash_entries, 2864 thash_entries,
2865 (num_physpages >= 128 * 1024) ? 2865 (totalram_pages >= 128 * 1024) ?
2866 13 : 15, 2866 13 : 15,
2867 0, 2867 0,
2868 &tcp_hashinfo.ehash_size, 2868 &tcp_hashinfo.ehash_size,
@@ -2879,7 +2879,7 @@ void __init tcp_init(void)
2879 alloc_large_system_hash("TCP bind", 2879 alloc_large_system_hash("TCP bind",
2880 sizeof(struct inet_bind_hashbucket), 2880 sizeof(struct inet_bind_hashbucket),
2881 tcp_hashinfo.ehash_size, 2881 tcp_hashinfo.ehash_size,
2882 (num_physpages >= 128 * 1024) ? 2882 (totalram_pages >= 128 * 1024) ?
2883 13 : 15, 2883 13 : 15,
2884 0, 2884 0,
2885 &tcp_hashinfo.bhash_size, 2885 &tcp_hashinfo.bhash_size,
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index b37109817a98..7c9ec3dee96e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1245,9 +1245,9 @@ static int nf_conntrack_init_init_net(void)
1245 * machine has 512 buckets. >= 1GB machines have 16384 buckets. */ 1245 * machine has 512 buckets. >= 1GB machines have 16384 buckets. */
1246 if (!nf_conntrack_htable_size) { 1246 if (!nf_conntrack_htable_size) {
1247 nf_conntrack_htable_size 1247 nf_conntrack_htable_size
1248 = (((num_physpages << PAGE_SHIFT) / 16384) 1248 = (((totalram_pages << PAGE_SHIFT) / 16384)
1249 / sizeof(struct hlist_head)); 1249 / sizeof(struct hlist_head));
1250 if (num_physpages > (1024 * 1024 * 1024 / PAGE_SIZE)) 1250 if (totalram_pages > (1024 * 1024 * 1024 / PAGE_SIZE))
1251 nf_conntrack_htable_size = 16384; 1251 nf_conntrack_htable_size = 16384;
1252 if (nf_conntrack_htable_size < 32) 1252 if (nf_conntrack_htable_size < 32)
1253 nf_conntrack_htable_size = 32; 1253 nf_conntrack_htable_size = 32;
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index a6ac83a93348..f01955cce314 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -617,7 +617,7 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
617 int cpu; 617 int cpu;
618 618
619 /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */ 619 /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
620 if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > num_physpages) 620 if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages)
621 return NULL; 621 return NULL;
622 622
623 newinfo = kzalloc(XT_TABLE_INFO_SZ, GFP_KERNEL); 623 newinfo = kzalloc(XT_TABLE_INFO_SZ, GFP_KERNEL);
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 219dcdbe388c..dd16e404424f 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -194,9 +194,9 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, u_int8_t family)
194 if (minfo->cfg.size) 194 if (minfo->cfg.size)
195 size = minfo->cfg.size; 195 size = minfo->cfg.size;
196 else { 196 else {
197 size = ((num_physpages << PAGE_SHIFT) / 16384) / 197 size = ((totalram_pages << PAGE_SHIFT) / 16384) /
198 sizeof(struct list_head); 198 sizeof(struct list_head);
199 if (num_physpages > (1024 * 1024 * 1024 / PAGE_SIZE)) 199 if (totalram_pages > (1024 * 1024 * 1024 / PAGE_SIZE))
200 size = 8192; 200 size = 8192;
201 if (size < 16) 201 if (size < 16)
202 size = 16; 202 size = 16;
@@ -266,9 +266,9 @@ static int htable_create(struct xt_hashlimit_mtinfo1 *minfo, u_int8_t family)
266 if (minfo->cfg.size) { 266 if (minfo->cfg.size) {
267 size = minfo->cfg.size; 267 size = minfo->cfg.size;
268 } else { 268 } else {
269 size = (num_physpages << PAGE_SHIFT) / 16384 / 269 size = (totalram_pages << PAGE_SHIFT) / 16384 /
270 sizeof(struct list_head); 270 sizeof(struct list_head);
271 if (num_physpages > 1024 * 1024 * 1024 / PAGE_SIZE) 271 if (totalram_pages > 1024 * 1024 * 1024 / PAGE_SIZE)
272 size = 8192; 272 size = 8192;
273 if (size < 16) 273 if (size < 16)
274 size = 16; 274 size = 16;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c5aab6a368ce..55180b99562a 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2091,10 +2091,10 @@ static int __init netlink_proto_init(void)
2091 if (!nl_table) 2091 if (!nl_table)
2092 goto panic; 2092 goto panic;
2093 2093
2094 if (num_physpages >= (128 * 1024)) 2094 if (totalram_pages >= (128 * 1024))
2095 limit = num_physpages >> (21 - PAGE_SHIFT); 2095 limit = totalram_pages >> (21 - PAGE_SHIFT);
2096 else 2096 else
2097 limit = num_physpages >> (23 - PAGE_SHIFT); 2097 limit = totalram_pages >> (23 - PAGE_SHIFT);
2098 2098
2099 order = get_bitmask_order(limit) - 1 + PAGE_SHIFT; 2099 order = get_bitmask_order(limit) - 1 + PAGE_SHIFT;
2100 limit = (1UL << order) / sizeof(struct hlist_head); 2100 limit = (1UL << order) / sizeof(struct hlist_head);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index c557f1fb1c66..612dc878e05c 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1184,10 +1184,10 @@ SCTP_STATIC __init int sctp_init(void)
1184 /* Size and allocate the association hash table. 1184 /* Size and allocate the association hash table.
1185 * The methodology is similar to that of the tcp hash tables. 1185 * The methodology is similar to that of the tcp hash tables.
1186 */ 1186 */
1187 if (num_physpages >= (128 * 1024)) 1187 if (totalram_pages >= (128 * 1024))
1188 goal = num_physpages >> (22 - PAGE_SHIFT); 1188 goal = totalram_pages >> (22 - PAGE_SHIFT);
1189 else 1189 else
1190 goal = num_physpages >> (24 - PAGE_SHIFT); 1190 goal = totalram_pages >> (24 - PAGE_SHIFT);
1191 1191
1192 for (order = 0; (1UL << order) < goal; order++) 1192 for (order = 0; (1UL << order) < goal; order++)
1193 ; 1193 ;