Re: [PATCH 4/4] RISC-V: KVM: Add the eager_page_split module parameter
Anup Patel <[email protected]>
| Newsgroups | org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAAhSdy13aO5b7rXfE4eNz+r8cLUhN3-T_YMegRPE2=15KCR1+Q@mail.gmail.com> |
On Wed, May 13, 2026 at 1:15 PM <[email protected]> wrote: > > From: Wang Yechao <[email protected]> > > Add an eager_page_split module parameter for RISC-V KVM, following > the same approach as on x86. This parameter controls whether eager > page splitting is enabled. The default value is on. > > When eager page splitting is enabled, KVM proactively splits large > pages (huge pages) into smaller pages when needed for dirty logging > or other operations. Disabling it can be beneficial for VM workloads > that rarely perform writes, or that only write to a small region of > memory, as it allows huge pages to remain intact for read accesses. > > Signed-off-by: Wang Yechao <[email protected]> Update Documentation/admin-guide/kernel-parameters.txt as part of this patch. Regards, Anup > --- > arch/riscv/kvm/mmu.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c > index 2cdea3e3ed4b..2af03c48aff3 100644 > --- a/arch/riscv/kvm/mmu.c > +++ b/arch/riscv/kvm/mmu.c > @@ -16,6 +16,9 @@ > #include <asm/kvm_mmu.h> > #include <asm/kvm_nacl.h> > > +bool __read_mostly eager_page_split = true; > +module_param(eager_page_split, bool, 0644); > + > static void mmu_wp_memory_region(struct kvm *kvm, int slot) > { > struct kvm_memslots *slots = kvm_memslots(kvm); > @@ -148,8 +151,10 @@ void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm, > > kvm_riscv_gstage_wp_range(&gstage, start, end); > > - if (kvm_dirty_log_manual_protect_and_init_set(kvm)) > - kvm_riscv_split_huge_pages(&gstage, start, end, true); > + if (kvm_dirty_log_manual_protect_and_init_set(kvm)) { > + if (READ_ONCE(eager_page_split)) > + kvm_riscv_split_huge_pages(&gstage, start, end, true); > + } > } > > void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot) > @@ -214,7 +219,9 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, > if (kvm_dirty_log_manual_protect_and_init_set(kvm)) > return; > mmu_wp_memory_region(kvm, new->id); > - kvm_riscv_split_memory_region(kvm, new->id); > + > + if (READ_ONCE(eager_page_split)) > + kvm_riscv_split_memory_region(kvm, new->id); > } > } > > -- > 2.27.0 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv