On 06/29/2018 07:29 AM, Rik van Riel wrote: > The latter problem can be prevented in two ways. The first is to > always send a TLB shootdown IPI to CPUs in lazy TLB mode, while > the second one is to only send the TLB shootdown at page table > freeing time.
I've read this a few times, and I keep having to remind myself why we "always send a TLB shootdown IPI to CPUs in lazy TLB mode". It's not strictly CPUs in lazy TLB mode, right? It's just the one that are in lazy TLB mode _and_ using the mm from which we are freeing page tables. If you revise these again, would it make sense to add a little blurb like: CPUs in lazy TLB mode are using the "wrong" page tables, generally from a process's mm while running true kernel code like the idle task. This is just as problematic when freeing page tables from that mm as a real non-lazy user of the page tables would be. > The second should result in fewer IPIs, since operationgs like > mprotect and madvise are very common with some workloads, but > do not involve page table freeing. Also, on munmap, batching > of page table freeing covers much larger ranges of virtual > memory than the batching of unmapped user pages. Doesn't this also result in fewer IPIs because it *removes* the processor from the mm_cpumask(mm) and won't send IPIs to it any more? As it stood before, we'd IPI a lazy CPU over and over, but this way we just do it once, switch to another mm, and never touch for this mm again (unless that CPU becomes non-lazy and switches to that mm again).