Re: [MODSLAB 0/7] A modular slab allocator V1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 16 Aug 2006, Manfred Spraul wrote:

> The lack of virt_to_page() on vmalloc/mempool memory. always prevented the
> slab allocator from handling such memory.

Guess you need this patch for the slabifier to make it work:

Index: linux-2.6.18-rc4/mm/slabifier.c
===================================================================
--- linux-2.6.18-rc4.orig/mm/slabifier.c	2006-08-16 14:25:18.449419152 -0700
+++ linux-2.6.18-rc4/mm/slabifier.c	2006-08-16 15:13:18.687428561 -0700
@@ -638,7 +638,12 @@ static struct page *get_object_page(cons
 {
 	struct page * page;
 
-	page = virt_to_page(x);
+	if ((unsigned long)x >= VMALLOC_START &&
+			(unsigned long)x < VMALLOC_END)
+		page = vmalloc_to_page(x);
+	else
+		page = virt_to_page(x);
+
 	if (unlikely(PageCompound(page)))
 		page = (struct page *)page_private(page);
 
Index: linux-2.6.18-rc4/mm/memory.c
===================================================================
--- linux-2.6.18-rc4.orig/mm/memory.c	2006-08-06 11:20:11.000000000 -0700
+++ linux-2.6.18-rc4/mm/memory.c	2006-08-16 15:14:01.595912665 -0700
@@ -2432,7 +2432,7 @@ int make_pages_present(unsigned long add
 /* 
  * Map a vmalloc()-space virtual address to the physical page.
  */
-struct page * vmalloc_to_page(void * vmalloc_addr)
+struct page * vmalloc_to_page(const void * vmalloc_addr)
 {
 	unsigned long addr = (unsigned long) vmalloc_addr;
 	struct page *page = NULL;
Index: linux-2.6.18-rc4/include/linux/mm.h
===================================================================
--- linux-2.6.18-rc4.orig/include/linux/mm.h	2006-08-06 11:20:11.000000000 -0700
+++ linux-2.6.18-rc4/include/linux/mm.h	2006-08-16 15:14:25.875663886 -0700
@@ -1013,7 +1013,7 @@ static inline unsigned long vma_pages(st
 }
 
 struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
-struct page *vmalloc_to_page(void *addr);
+struct page *vmalloc_to_page(const void *addr);
 unsigned long vmalloc_to_pfn(void *addr);
 int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
 			unsigned long pfn, unsigned long size, pgprot_t);
-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux