vmap_pages() for 2.5.27
Subsystems (3)
PATCH 1/1 vmap_pages() for 2.5.27
[Resending this against 2.5.27]
There's more and more pressure getting XFS into mainline now that most distributors ship it and SGI's Red Hat-based installers are in wide use, and although most of the core kernel changes in the XFS tree have been removed by redesigning/rewriting XFS code.
Still there are a bunch of core code changes that are needed for XFS to work without beeing totally rewritten and this patch is an alternate version (which should also be usable properly for non-XFS purposes) of the probably most important missing core functionality needed by XFS.
The vmap_pages() functions allows to map an array of virtually non-continguos pages into the kernel virtual memory. The implementation is very simple and a small variation of vmalloc() - instead of allocating new pages in alloc_area_pte() uncondintionally a pointer to a page array is passed down all through vmalloc_area_pages => alloc_area_pmd => alloc_area_pte and if it is non-null no pages are allocated but the reference count on the existing ones is incremented.
The old vmalloc_area_pages is renamed to __vmap_area_pages and vmalloc_area_pages is a small wrapper around it, passing in an NULL page array. Similarly __vmalloc is renamed to vmap_pages and a small wrapper is added.
In addition I've removed th unused vmalloc_dma and cleaned up vmalloc.h a little - this could need more cleanup (and kdoc documentation for the vmalloc.c stuff), but I will do this later in an incremental patch.
drivers/char/mem.c +3 -2
@@ -42,6 +42,9 @@#if defined(CONFIG_S390_TAPE ) && defined(CONFIG_S390_TAPE_CHAR )extern void tapechar_init (void );#endif + +extern long vwrite (char *buf,char *addr,unsigned long count); +extern long vread (char *buf,char *addr,unsigned long count);static ssize_t do_write_mem (struct file * file,void *p,unsigned long realp,const char * buf,size_t count,loff_t *ppos)
@@ -273,8 +276,6 @@return virtr + read; } -extern long vwrite (char *buf,char *addr,unsigned long count); -/* * This function writes to the *virtual* memory as seen by the kernel. */
kernel/ksyms.c +1 -0
@@ -112,6 +112,7 @@EXPORT_SYMBOL (vmalloc);EXPORT_SYMBOL (vmalloc_32);EXPORT_SYMBOL (vmalloc_to_page); +EXPORT_SYMBOL (vmap_pages);EXPORT_SYMBOL (mem_map);EXPORT_SYMBOL (remap_page_range);EXPORT_SYMBOL (max_mapnr);
include/linux/vmalloc.h +15 -16
@@ -1,10 +1,12 @@ -#ifndef __LINUX_VMALLOC_H -#define __LINUX_VMALLOC_H +#ifndef _LINUX_VMALLOC_H +#define _LINUX_VMALLOC_H#include <linux/spinlock.h> -#include <asm/pgtable.h> +struct page ; + +/* bits in vm_struct->flags */ #define VM_IOREMAP 0x00000001/* ioremap() and friends */ #define VM_ALLOC 0x00000002/* vmalloc() */
@@ -17,28 +19,25 @@struct vm_struct * next; }; -extern struct vm_struct *get_vm_area (unsigned long size,unsigned long flags); -extern void vfree (void * addr); +extern void *__vmalloc (unsigned long size,int gfp_mask,pgprot_t prot); -extern long vread (char *buf,char *addr,unsigned long count); -extern void vmfree_area_pages (unsigned long address,unsigned long size); +extern void *vmalloc (unsigned long size); +extern void *vmalloc_32 (unsigned long size); +extern void *vmap_pages (struct page **pages,unsigned long size, +int gfp_mask,pgprot_t prot); +extern void vfree (void * addr); + +extern struct vm_struct *get_vm_area (unsigned long size,unsigned long flags);extern int vmalloc_area_pages (unsigned long address,unsigned long size,int gfp_mask,pgprot_t prot); +extern void vmfree_area_pages (unsigned long address,unsigned long size);extern struct vm_struct *remove_kernel_area (void *addr);/* -* Various ways to allocate pages. -*/ - -extern void *vmalloc (unsigned long size); -extern void *vmalloc_32 (unsigned long size); - -/* * vmlist_lock is a read-write spinlock that protects vmlist * Used in mm/vmalloc.c (get_vm_area() and vfree()) and fs/proc/kcore.c. */ extern rwlock_t vmlist_lock; -extern struct vm_struct * vmlist; -#endif +#endif /* _LINUX_VMALLOC_H */
mm/vmalloc.c +60 -43
166 lines not on this page · raw message
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/