I'd like to ask a question about vmalloc().
According to the documentation from kernel.org, it says:
Allocate enough pages to cover size from the page level allocator and map them into contiguous kernel virtual space.
Does that mean the (starting) address returned by vmalloc() will be a multiple of PAGE_SIZE?
Below is my thoughts:
I have tried to call vmalloc() and printed out the address in hexadecimal. The last three bits are all zeros, and the value of PAGE_SIZE is 4096 on my system, which, kind of proves my assumption. Besides, in mmap(),
void *mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset);
and the manpage also says,
If addr is NULL, then the kernel chooses the (page-aligned) address at which to create the mapping; this is the most portable method of creating a new mapping. If addr is not NULL, then the kernel takes it as a hint about where to place the mapping; on Linux, the kernel will pick a nearby page boundary (but always above or equal to the value specified by /proc/sys/vm/mmap_min_addr) and attempt to create the mapping there.
offset must be a multiple of the page size
A file is mapped in multiples of the page size.
The above seems to prove my assumption, but I am not quite sure. Any thoughts would be appreciated.