[lkml]   [2002]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch, 2.5] __vmalloc allocates spurious page?

I think __vmalloc allocates an unnecessary page. While the virtual
address space should have a one-page hole in it, that is taken care of
by get_vm_area. All other routines (particularly map_vm_area)
subtract PAGE_SIZE from area->size before usage, so the last page
table entry isn't even set up.

The unnecessary page is allocated only if size is initially a multiple
of PAGE_SIZE, which sounds like a common case.


diff -Naurd --exclude-from=/home/maalanen/linux/base/diff_exclude linus-2.5.42/mm/vmalloc.c msa-2.5.42/mm/vmalloc.c
--- linus-2.5.42/mm/vmalloc.c Sat Oct 12 16:42:57 2002
+++ msa-2.5.42/mm/vmalloc.c Tue Oct 15 21:53:10 2002
@@ -387,7 +387,7 @@
if (!area)
return NULL;

- nr_pages = (size+PAGE_SIZE) >> PAGE_SHIFT;
+ nr_pages = (size+PAGE_SIZE-1) >> PAGE_SHIFT;
array_size = (nr_pages * sizeof(struct page *));

area->nr_pages = nr_pages;
Marcus Alanen * Software Construction Laboratory * * *

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:30    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean