Small do_mmap_pgoff correction
Hi David :)
Quoted 3 lines
+ * NOTE: in this function we rely on
TASK_SIZEbeing lower than
+ * SIZE_MAX-PAGE_SIZE at least. I'm pretty sure that it is.
This assumption is wrong.
OK, then another way of fixing the corner case that exists indo_mmap_pgoff is needed. You cannot mmap a chunk of memory whose size is bigger than SIZE_MAX-PAGE_SIZE, because 'PAGE_ALIGN' will return 0 when page-aligning the size.
Anyway you cannot use a size larger than SIZE_MAX-PAGE_SIZE even
on sparc64, since mmap will fail when page aligning such a size, returning 0 :((( Reverting the change is worse (IMHO).
Quoted 1 line
Please revert this change, it adds absolutely nothing.
It corrects the corner case. See below. If you have a better
solution for the corner case problem that doesn't involve limiting the max size you can request for mmaping so it doesn't get the last page, it is welcome, of course :))
The code says:
if ((len = PAGE_ALIGN(len)) == 0)
and this returns 0 if the requested size ('len', here) is between
SIZE_MAX-PAGE_SIZE and SIZE_MAX. And this is wrong. Don't know if under sparc64 the PAGE_ALIGN macro returns correct values, but I don't think so, since the correct value for an address in the last page is 0 when page aligned. The problem is that we are aligning a SIZE, not an address :((
Maybe a new macro needed here...
If you want the entire explanation, just tell :) I wrote in the
past for the same patch. Anyway, nor Linus nor Alan did see anything wrong with this :??
Raúl
vmalloc
Hi,
Is there any limitation on the amount of memory that can be allocated by using vmalloc ( like 128KB for kmalloc) ?
Thanks,
Imran.
Re: vmalloc
Quoted 5 lines · Imran Badr
Hi,
Is there any limitation on the amount of memory that can be allocated by using vmalloc ( like 128KB for kmalloc) ?
for x86 you shouldn't count on being to get more than 64Mb of vmalloc memory (even though most machines go upto 128Mb at least)
RE: vmalloc
Quoted 7 lines
Quoted 3 lines
Is there any limitation on the amount of
memory that can be allocated by using vmalloc
( like 128KB for kmalloc) ?for x86 you shouldn't count on being to get more
than 64Mb of vmalloc memory (even though most
machines go upto 128Mb at least)
According to the specifications, vmalloc is limited only by the amount of physical memory on your machine. However, Arjan VanDeVen has a point. Other process are already using physical memory (like the kernel process), and those process count against the physical memory available.
TIP: It's always nice to leave at least 20% of the physical memory free for other critical processes, especially those that can't be swapped out.
Joseph Wagner