[kvm-unit-tests RFC PATCH 03/10] x86: vm: Improve suboptimal large page allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently large pages are not used in case an address
to be mapped is not aligned on large page boundary.
This update allows using large pages whenever possible.

Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx>
Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
---
 lib/x86/vm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index b9fa5cd3c389..72f6b380bb79 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -101,6 +101,12 @@ static void setup_mmu_range(unsigned long *cr3, unsigned long start,
 	u64 max = (u64)len + (u64)start;
 	u64 phys = start;
 
+	while (phys + PAGE_SIZE <= max) {
+		if (!(phys % LARGE_PAGE_SIZE))
+			break;
+		install_page(cr3, phys, (void *)(ulong)phys);
+		phys += PAGE_SIZE;
+	}
 	while (phys + LARGE_PAGE_SIZE <= max) {
 		install_large_page(cr3, phys, (void *)(ulong)phys);
 		phys += LARGE_PAGE_SIZE;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux