On Fri, May 27, 2022 at 01:19:55PM +0200, Jan Beulich wrote: > When a page table ends up with all contiguous entries (including all > identical attributes), it can be replaced by a superpage entry at the > next higher level. The page table itself can then be scheduled for > freeing. > > The adjustment to LEVEL_MASK is merely to avoid leaving a latent trap > for whenever we (and obviously hardware) start supporting 512G mappings. > > Note that cache sync-ing is likely more strict than necessary. This is > both to be on the safe side as well as to maintain the pattern of all > updates of (potentially) live tables being accompanied by a flush (if so > needed). > > Signed-off-by: Jan Beulich <[email protected]> > Reviewed-by: Kevin Tian <[email protected]>
Reviewed-by: Roger Pau Monné <[email protected]> > --- > Unlike the freeing of all-empty page tables, this causes quite a bit of > back and forth for PV domains, due to their mapping/unmapping of pages > when they get converted to/from being page tables. It may therefore be > worth considering to delay re-coalescing a little, to avoid doing so > when the superpage would otherwise get split again pretty soon. But I > think this would better be the subject of a separate change anyway. > > Of course this could also be helped by more "aware" kernel side > behavior: They could avoid immediately mapping freed page tables > writable again, in anticipation of re-using that same page for another > page table elsewhere. Could we provide an option to select whether to use super-pages for IOMMU, so that PV domains could keep the previous behavior? Thanks, Roger.
