[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch #4818] Dynamic memory allocation for Linux Device drivers in glue
From: |
Gianluca Guida |
Subject: |
[patch #4818] Dynamic memory allocation for Linux Device drivers in glue. |
Date: |
Fri, 27 Jan 2006 21:41:05 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 |
Follow-up Comment #2, patch #4818 (project hurd):
This is a new version of the zoned patch, which permits the linux glue to
dynamically allocate memory.
Changes in this patch are a new function, linux_kmem_collect that now get
called by vm_pageout_scan.
Here's the changelog entry:
2006-01-20 Gianluca Guida <glguida@gmail.com>
* vm/pmap.h (pmap_is_dma, pmap_is_normal): New functions.
* vm/page.h (VM_PAGE_DMA): New macro.
(vm_page_queue_free): Variable removed.
(vm_page_queue_free_dma, vm_page_queue_free_normal): New
variables.
(vm_page_physaddr_lookup, vm_page_grab_flags)
(vm_page_grab_contiguous_pages_flags): New functions.
(first_phys_addr, last_phys_addr): Declarations removed.
(phys_first_addr, phys_last_addr): New declarations.
* vm/vm_resident.c (vm_page_free_bitmap)
(vm_page_free_bitmap_bitsz): New variables.
(vm_page_free_bitmap_set, vm_page_free_bitmap_unset)
(vm_page_free_bitmap_alloc, vm_page_array_init, vm_page_array_add)
(vm_page_physaddr_lookup): New functions.
(vm_page_bootstrap): Initialize vm_page_queue_free_normal and
vm_page_queue_free_dma. Call vm_page_free_bitmap_alloc.
(pmap_startup): Call vm_page_array_init. Add page to vm_page_array
for physaddress-to-vm_page_t resolution. Do not release page in
any particular order.
(vm_page_create): Add page to vm_page_array.
(vm_page_grab_flags, vm_page_grab_contiguous_pages_queue)
(vm_page_grab_contiguous_flags): New functions.
(vm_page_grab, vm_page_grab_contiguous_pages): Function rewritten.
(vm_page_release): Select proper free list based on page type (DMA
or non-DMA). Use Mach's queue handling funcitons not .next and
.prev pointers manually. Set vm_page_free_bitmap when freeing a
page.
* i386/i386at/model_dep.c (use_all_mem): Always set to 1.
(init_alloc_aligned): Do not use any particular oder during
bootstrap allocation.
(alloc_dma_mem): Function removed.
* kern/startup.c: Include <vm/pmap.h>.
(setup_main): Calculate memory size using phys_last_addr and
phys_first_addr.
* i386/intel/pmap.c (vm_page_normal_first, vm_page_normal_last)
(vm_page_dma_first, vm_page_dma_last): New variables.
(pmap_bootstrap): Set proper values to vm_page_normal_* and
vm_page_dma_* based on system's memory.
(pmap_is_dma, pmap_is_normal): New functions.
* kern/startup.c: Removed /* XXX */ comments, since phys_last_addr
and phys_first_addr are exported by pmap.c now.
* linux/dev/glue/kmem.c: Include <mach/error.h>
(MEM_CHUNK_SIZE, MEM_CHUNKS, NBPW): Macro removed.
(pages_free, memlist, num_page_collect, linux_mem_avail):
Variables removed.
(memlist_dma, memlist_nml): New variables.
(linux_kmem_init): No initialization needed anymore (all code
removed).
(coalesce_blocks): Coalesce separately DMA memory blocks and
non-DMA memory blocks.
(linux_kmalloc): Check for DMA in priority argument. Select proper
memlist to get blocks from. Pass dma information to
__get_free_pages.
(linux_kfree): Select proper memlist to free memory into.
(collect_kmalloc_pages): Function removed.
(collect_kmalloc_pages_dma, collect_kmalloc_pages_nml)
(linux_kmem_collect): New functions.
(__get_free_pages, free_pages): Functions rewritten.
* linux/dev/init/main.c (CONTIG_ALLOC, NBPW): Macro removed.
(CONTIG_ALLOC_ORDER): New macro.
(linux_init): Use __getfreepages to allocate PCI initialization
memory and free_pages to free it.
(alloc_contig_mem, free_contig_mem): Functions removed.
* vm/vm_pageout.c (vm_pageout_scan) [LINUX_DEV]: Call
linux_kmem_collect.
_______________________________________________________
Additional Item Attachment:
File name: vm_resident-zoned-patch-3.diff Size:43 KB
vm_resident zoned patch 3. Linux glue\'s unused memory is now collected by
pageout daemon.
<http://savannah.gnu.org/patch/download.php?item_id=4818&item_file_id=5831>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?func=detailitem&item_id=4818>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/