Hi, Arnd, On Mon, Jun 20, 2022 at 7:27 PM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > On Mon, Jun 20, 2022 at 12:24 PM Huacai Chen <chenhuacai@xxxxxxxxxx> wrote: > > On Fri, Jun 17, 2022 at 11:42 PM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > > > > > On Fri, Jun 17, 2022 at 4:58 PM Huacai Chen <chenhuacai@xxxxxxxxxxx> wrote: > > > > > > > > Add sparse memory vmemmap support for LoongArch. SPARSEMEM_VMEMMAP > > > > uses a virtually mapped memmap to optimise pfn_to_page and page_to_pfn > > > > operations. This is the most efficient option when sufficient kernel > > > > resources are available. > > > > > > I have not looked at this in detail, but from a high-level perspective, it > > > seems very similar to the corresponding code in arch/arm64 and arch/x86. > > > > > > Can you try to merge the three copies into a generic helper and add that > > > to mm/sparse-vmemmap.c? If this does not work, can you describe in the > > > changelog text why these have to be architecture specific? > > > > It is difficult to merge, because LoongArch needs to call pud_init(), > > pmd_init() and other similar things which are unnecessary on ARM64 and > > X86. > > I can see that this part of the code is the same as mips. What is the > initialization > for? Can it be encapsulated in an architecture specific inline > function (for mips > and loongarch), with a generic version like this? > > #ifndef pud_init_invalid > static inline void pud_init_invalid(void *) {} > #endif OK, let's have a try. Huacai > > Arnd