> On Jan 22, 2022, at 3:31 AM, Mike Rapoport <rppt@xxxxxxxxxx> wrote: > > (added linux-api) > >> On Tue, Jan 18, 2022 at 02:19:12PM -0700, Khalid Aziz wrote: >> Page tables in kernel consume some of the memory and as long as >> number of mappings being maintained is small enough, this space >> consumed by page tables is not objectionable. When very few memory >> pages are shared between processes, the number of page table entries >> (PTEs) to maintain is mostly constrained by the number of pages of >> memory on the system. As the number of shared pages and the number >> of times pages are shared goes up, amount of memory consumed by page >> tables starts to become significant. Sharing PTEs is nice, but merely sharing a chunk of address space regardless of optimizations is nontrivial. It’s also quite useful, potentially. So I think a good way to start would be to make a nice design for just sharing address space and then, on top of it, figure out how to share page tables. See here for an earlier proposal: https://lore.kernel.org/all/CALCETrUSUp_7svg8EHNTk3nQ0x9sdzMCU=h8G-Sy6=SODq5GHg@xxxxxxxxxxxxxx/ Alternatively, one could try to optimize memfd so that large similarly aligned mappings in different processes could share page tables. Any of the above will require some interesting thought as to whether TLB shootdowns are managed by the core rmap code or by mmu notifiers.