Re: [PATCH 3/4] arm64: mm: support large block mapping when rodata=full
From: Yang Shi <hidden>
Date: 2025-08-06 00:10:08
Also in:
lkml
quoted
--- snip ---I'm afraid I'll have to agree with Ryan :) Looking at the signature of split_kernel_pgtable_mapping, one would expect that this function splits all block mappings in this region. But that is just a nit; it does not seem right to me that we are iterating over the entire space when we know *exactly* where we have to make the split, just to save on pgd/p4d/pud loads - the effect of which is probably cancelled out by unnecessary iterations your approach takes to skip the intermediate blocks.The implementation is aimed to reuse the split code for repainting. We have to split all leaf mappings down to PTEs for repainting. Now Ryan suggested use pgtable walk API for repainting, it made the duplicate code problem gone. We had some discussion in the other series.quoted
If we are concerned that most change_memory_common() operations are for a single page, then we can do something like: unsigned long size = end - start; bool end_split, start_split = false; if (start not aligned to block mapping) start_split = split(start); /* * split the end only if the start wasn't split, or * if it cannot be guaranteed that start and end lie * on the same contig block */ if (!start_split || (size > CONT_PTE_SIZE)) end_split = split(end);Thanks for the suggestion. It works for some cases, but I don't think it can work if the range is cross page table IIUC. For example, start is in a PMD, but end is in another PMD.
I think we have to call split_mapping(end) if size is greater than page size, i.e. split_mapping(start); if (size > PAGE_SIZE) split_mapping(end); This can avoid walking page table twice for page size range, which should be the most case in the current kernel. Thanks, Yang
Regards, Yangquoted