On Tue, Nov 8, 2022 at 3:44 AM Christophe Leroy <christophe.leroy@xxxxxxxxxx> wrote: > [...] > > > > execmem_alloc() manages a set of PMD_SIZE RO+X memory, and allocates these > > memory to its users. execmem_alloc() is used to free memory allocated by > > execmem_alloc(). execmem_fill() is used to update memory allocated by > > execmem_alloc(). > > > > Memory allocated by execmem_alloc() is RO+X, so this doesnot violate W^X. > > The caller has to update the content with text_poke like mechanism. > > Specifically, execmem_fill() is provided to update memory allocated by > > execmem_alloc(). execmem_fill() also makes sure the update stays in the > > boundary of one chunk allocated by execmem_alloc(). Please refer to patch > > 1/5 for more details of > > > > Patch 3/5 uses these new APIs in bpf program and bpf dispatcher. > > > > Patch 4/5 and 5/5 allows static kernel text (_stext to _etext) to share > > PMD_SIZE pages with dynamic kernel text on x86_64. This is achieved by > > allocating PMD_SIZE pages to roundup(_etext, PMD_SIZE), and then use > > _etext to roundup(_etext, PMD_SIZE) for dynamic kernel text. > > Would it be possible to have something more generic than being stuck to > PMD_SIZE ? > > On powerpc 8xx, PMD_SIZE is 4MB and hugepages are 512kB and 8MB. Currently, __vmalloc_node_range() tries to allocate huge pages when size_per_node >= PMD_SIZE How do we handle this in powerpc 8xx? I guess we can use the same logic here? Thanks, Song