Re: [PATCH v2 7/8] execmem: add support for cache of large ROX pages
Christophe Leroy <[email protected]>
| Newsgroups | gmane.linux.ports.ppc64.devel,gmane.linux.kernel.bpf,gmane.linux.ports.alpha,gmane.linux.kernel.cross-arch,gmane.linux.ports.arm.kernel,gmane.linux.ports.hexagon,gmane.linux.kernel,gmane.linux.ports.mips,gmane.linux.kernel.mm,gmane.linux.kernel.modules,gmane.linux.ports.parisc,gmane.linux.ports.riscv,gmane.linux.ports.sh.devel,gmane.linux.kernel.arc,gmane.linux.uml.devel,gmane.linux.ports.sparc |
|---|---|
| Message-ID | <[email protected]> |
Le 26/08/2024 à 08:55, Mike Rapoport a écrit : > From: "Mike Rapoport (Microsoft)" <[email protected]> > > Using large pages to map text areas reduces iTLB pressure and improves > performance. > > Extend execmem_alloc() with an ability to use PMD_SIZE'ed pages with ROX > permissions as a cache for smaller allocations. Why only PMD_SIZE ? On power 8xx, PMD_SIZE is 4M and the 8xx doesn't have such a page size. When you call vmalloc() with VM_ALLOW_HUGE_VMAP you get 16k pages or 512k pages depending on the size you ask for, see function arch_vmap_pte_supported_shift() > > To populate the cache, a writable large page is allocated from vmalloc with > VM_ALLOW_HUGE_VMAP, filled with invalid instructions and then remapped as > ROX. > > Portions of that large page are handed out to execmem_alloc() callers > without any changes to the permissions. > > When the memory is freed with execmem_free() it is invalidated again so > that it won't contain stale instructions. > > The cache is enabled when an architecture sets EXECMEM_ROX_CACHE flag in > definition of an execmem_range. > Christophe