aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRavikiran G Thirumalai <kiran@scalex86.org>2006-01-06 03:11:01 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:26 -0500
commit008857c1a49ccffc31a54c3ea7e182833bd61304 (patch)
treeba65452db097f57e05d2e3df550d55d45feabc94 /mm
parent085cc7d5de3cc662da7ea78296464a0d52f3f01f (diff)
[PATCH] Cleanup bootmem allocator and fix alloc_bootmem_low
Patch cleans up the alloc_bootmem fix for swiotlb. Patch removes alloc_bootmem_*_limit api and fixes alloc_boot_*low api to do the right thing -- allocate from low32 memory. Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/bootmem.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 16b9465eb4e..cbb82ee14fb 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -393,15 +393,14 @@ unsigned long __init free_all_bootmem (void)
393 return(free_all_bootmem_core(NODE_DATA(0))); 393 return(free_all_bootmem_core(NODE_DATA(0)));
394} 394}
395 395
396void * __init __alloc_bootmem_limit (unsigned long size, unsigned long align, unsigned long goal, 396void * __init __alloc_bootmem(unsigned long size, unsigned long align, unsigned long goal)
397 unsigned long limit)
398{ 397{
399 pg_data_t *pgdat = pgdat_list; 398 pg_data_t *pgdat = pgdat_list;
400 void *ptr; 399 void *ptr;
401 400
402 for_each_pgdat(pgdat) 401 for_each_pgdat(pgdat)
403 if ((ptr = __alloc_bootmem_core(pgdat->bdata, size, 402 if ((ptr = __alloc_bootmem_core(pgdat->bdata, size,
404 align, goal, limit))) 403 align, goal, 0)))
405 return(ptr); 404 return(ptr);
406 405
407 /* 406 /*
@@ -413,15 +412,40 @@ void * __init __alloc_bootmem_limit (unsigned long size, unsigned long align, un
413} 412}
414 413
415 414
416void * __init __alloc_bootmem_node_limit (pg_data_t *pgdat, unsigned long size, unsigned long align, 415void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, unsigned long align,
417 unsigned long goal, unsigned long limit) 416 unsigned long goal)
418{ 417{
419 void *ptr; 418 void *ptr;
420 419
421 ptr = __alloc_bootmem_core(pgdat->bdata, size, align, goal, limit); 420 ptr = __alloc_bootmem_core(pgdat->bdata, size, align, goal, 0);
422 if (ptr) 421 if (ptr)
423 return (ptr); 422 return (ptr);
424 423
425 return __alloc_bootmem_limit(size, align, goal, limit); 424 return __alloc_bootmem(size, align, goal);
426} 425}
427 426
427#define LOW32LIMIT 0xffffffff
428
429void * __init __alloc_bootmem_low(unsigned long size, unsigned long align, unsigned long goal)
430{
431 pg_data_t *pgdat = pgdat_list;
432 void *ptr;
433
434 for_each_pgdat(pgdat)
435 if ((ptr = __alloc_bootmem_core(pgdat->bdata, size,
436 align, goal, LOW32LIMIT)))
437 return(ptr);
438
439 /*
440 * Whoops, we cannot satisfy the allocation request.
441 */
442 printk(KERN_ALERT "low bootmem alloc of %lu bytes failed!\n", size);
443 panic("Out of low memory");
444 return NULL;
445}
446
447void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
448 unsigned long align, unsigned long goal)
449{
450 return __alloc_bootmem_core(pgdat->bdata, size, align, goal, LOW32LIMIT);
451}