I'm interested in the way Linux mmaps files into the main memory (in my context its for executing, but I guess the mmap process is the same for writing and reading as well) and which size it uses.
So I know Linux uses paging with usually 4kB pagesize (where in the kernel can I find this size?). But what exactly does this mean for the memory allocated: Assume you have a binary of size of a few thousned bytes, lets just say 5812B and you execute it. What happens in the kernel: Does it allocate 2*4kB and then copy the 5812B into this space, wasting >3KB of main memory in the 2nd page?
It would be great if anyone knew the file in the kernel source where the pagesize is defined.
My 2nd question is also very simple I guess: I assumed 5812B as a filesize. Is it right, that this size is simply taken from the inode?