[lkml]   [2002]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [Q] get_ma_area() function
On Tue, 7 May 2002, Andrey Panin wrote:
> looking at mm/vmalloc.c i found one strange (for me) line of code.
> From mm/vmalloc.c:
> struct vm_struct * get_vm_area(unsigned long size, unsigned long flags)
> {
> unsigned long addr;
> struct vm_struct **p, *tmp, *area;
> area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
> if (!area)
> return NULL;
> size += PAGE_SIZE;
> ^^^^^^^^^^^^^^^^^^
> Why ? Maybe size = PAGE_ALIGN(size); is more correct here ?

No, __vmalloc already did the size = PAGE_ALIGN(size).
Here it is intentionally adding one page to the virtual allocation size,
to leave one invalid guard or fence page between vmalloc'ed allocations,
to trap overruns from one area to the next. You're right, a comment
would be appropriate there.


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:25    [W:0.033 / U:0.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site