>> This makes a *ton* of sense in effective_prot() especially. Its entire >> job is mirroring the hardware's job of inheriting permissions from >> higher levels of the page tables and enforcing them on lower level leaf >> entries. If a higher level is folded, there's nothing to inherit. >> >> I also think it's worth taking a brief pause on the coding to think >> about what kind of design would actually be nice here. If the design >> really is that the pgd is folded, the 'struct mm_walk_ops' code would >> ideally not even call ->pgd_entry(). It would just (for example) *start* >> at ->pud_entry() for a 3-level hardware page table. >> >> If there are no pgds, why bother calling ->pgd_entry()? It couldn't be >> done transparently to mm_walk users of course but it could be done >> incrementally where users move one at a time over to a new scheme. > > Agree. Calling a pXd_entry() about folded one seems meaningless. > But seems enough to check mm_pXd_folded() before calling pXd_entry() > in each walk_pXd_range().
Needs some double-checking that callers can handle it (like effective_prot() would currently not), but certainly something to look into! -- Cheers, David
