lkml.org 
[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: bootmem and mem_map allocation problem
Hi,

On Sun, 5 Dec 1999, Nicolas Pitre wrote:

> Even if the mem_map "holes" can be freed later, the valuable
> entries may not fit with the available memory layout, especially if we
> want to keep the virt_to_phys()/phys_to_virt() macros simple.

I used the patch below (for 2.3.28, but should still apply, I had time yet
to update yet), but it removes the requirement for an 1:1 mapping of
physical memory to the memmap. Instead the whole logic is in MAP_NR(),
where an abitrary logic to convert a virtual address into a map nr can be
implemented.

bye, Roman

--- linux-2.3.28.org/mm/bootmem.c Mon Nov 15 15:03:35 1999
+++ linux-2.3.28/mm/bootmem.c Mon Nov 15 19:07:35 1999
@@ -203,18 +203,19 @@
unsigned long __init free_all_bootmem (void)
{
struct page * page;
- unsigned long i, count, total = 0;
+ unsigned long i, nr, count, total = 0;

if (!bootmem_map) BUG();

- page = mem_map;
count = 0;
- for (i = 0; i < max_low_pfn; i++, page++) {
+ for (i = 0; i < max_low_pfn; i++) {
if (!test_bit(i, bootmem_map)) {
+ nr = MAP_NR(phys_to_virt(i << PAGE_SHIFT));
+ page = mem_map + nr;
count++;
ClearPageReserved(page);
set_page_count(page, 1);
- if (i >= (virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT))
+ if (nr >= (virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT))
clear_bit(PG_DMA, &page->flags);
__free_page(page);
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.074 / U:0.160 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site