The mmap length is page aligned, so if you request only 1 byte in a 4kb system, your mmap is aligned to 4k. See do_mmap_pgoff (mm/mmap.c) for details.
From mmap man page:
"A file is mapped in multiples of the page size. For a file that is not a multiple of the page
size, the remaining memory is zeroed when mapped, and writes to that region are not written out
to the file..."
Luciano Stertz
Ketan Mukadam wrote:
Hi all!!
Another query.....
A standard mmap implementation uses the following
vsize = vma->vm_end - vma->vm_start, which is the total virtual size.
I assume that this should be equal to the size requested by the application in its mmap system call.
But I get the value 1K greater than what is requested by the application...
Can anyone explain the behavior or am i doing something wrong?
I am working on kernel 2.4.21.
TIA Regards Ketan
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/
-- Luciano A. Stertz luciano@xxxxxxxxxxxx T&T Engenheiros Associados Ltda http://www.tteng.com.br Fone/Fax (51) 3224 8425
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/