Chuck Silvers <[email protected]> wrote: > - it would be better to remove the mappings before freeing the page > on all platforms, not just xen. that's just a good practice. > if you're concerned about a potential performance impact, > you could process the pages in batches of 16 or so using a little > array on the stack, which should handle most operations in one batch. > I did a quick experiment just now and found that most calls > to uvm_km_pgremove_intrsafe() are for 4 pages or less. > (I wonder why those aren't using some higher-level cache?) > about 10% of the calls were for 16 pages, and none were larger.
Yes. Also, one should be careful about potential race condition - that is, TLB invalidations must happen *before* VA becomes available for use by other processes. Otherwise, memory might be allocated with that VA range and used while TLB caches have stale entries i.e. pointing to a wrong physical page. > - the calls to pmap_update() should be moved along with the calls to > pmap_kremove(). Due to deferred TLB invalidations (or flush), we want to call pmap_update() at the point when all pmap_kremove() calls weere "collected". -- Mindaugas
