On Sun, 25 Mar 2001, Linus Torvalds wrote: > So my suggestion for PAE is: > > - populate in gdb_alloc() (ie just do the three "alloc_page()" calls to > allocate the PMD's immediately) > > NOTE: This makes the race go away, and will actually speed things up as > we will pretty much in practice always populate the PGD _anyway_, the > way the VM areas are laid out. > > - make "pgd_present()" always return 1. > > NOTE: This will speed up the page table walkers anyway. It will also > avoid the problem above. > > - make "free_pmd()" a no-op. > > All of the above will (a) simplify things (b) remove special cases and > (c) remove actual and existing bugs. yep, this truly makes things so much easier and cleaner! There was only one thing missing to make it work: - make "pgd_clear()" a no-op. [the reason for the slightly more complex pgd_alloc_slow() code is to support non-default virtual memory splits as well, where the number of user pgds is not necesserily 3.] plus i took to opportunity to reduce the allocation size of PAE-pgds. Their size is only 32 bytes, and we allocated a full page. Now the code kmalloc()s a 32 byte cacheline for the pgd. (there is a hardware constraint on alignment: this cacheline must be at least 16-byte aligned, which is true for the current kmalloc() code.) So the per-process cost is reduced by almost 4 KB. and i got rid of pgalloc-[2|3]level.h - with the pmds merged into the pgd logic the algorithmic difference between 2-level and this pseudo-3-level PAE paging is not that big anymore. The pgtable-[2|3]level.h files are still separate. the attached pae-2.4.3-B2 patch (against 2.4.3-pre7) compiles & boots just fine both in PAE and non-PAE mode. The patch removes 217 lines, and adds only 78 lines. Ingo