On Thu, 29 Mar 2018 22:48:24 +0800, Hao Lee said: > I'm confused about the meaning of the PAGE_SIZE macro in x86_64 > kernel. Its value is 4KB and I once thought it was the size of a > physical page frame, but now I think I'm wrong. I find that most of > the physical address space is mapped by PMD entries, which means the > actual physical page frame size is 2MB. Could someone explain why the > PAGE_SIZE is not 2MB in x86_64 kernel? Thanks! It's 4K for most things because using a fairly small page size is useful for pages that are likely to swap out. If the entire system used a 2MB page size, then each page fault would require the writing of 2MB out, and then reading 2MB back in. > mapped by PMD entries, which means the actual physical page frame size is 2MB Look closer. Each entry in a PMD table covers 2M - and either describes a 2M hugepage, or is a pointer to a table of PTE entries, each of which describes a 4K page.
Attachment:
pgpN1XjTqE1Ct.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies