[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/18] virtio-mem: don't warn about THP sizes on a kernel without
From: |
Michael S. Tsirkin |
Subject: |
[PULL 17/18] virtio-mem: don't warn about THP sizes on a kernel without THP support |
Date: |
Wed, 11 Sep 2024 09:52:18 -0400 |
From: David Hildenbrand <david@redhat.com>
If the config directory in sysfs does not exist at all, we are dealing
with a system that does not support THPs. Simply use 1 MiB block size
then, instead of warning "Could not detect THP size, falling back to
..." and falling back to the default THP size.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gavin Shan <gshan@redhat.com>
Cc: Juraj Marcin <jmarcin@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20240910163433.2100295-1-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-mem.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
index ef64bf1b4a..4075f3d4ce 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
@@ -88,6 +88,7 @@ static uint32_t virtio_mem_default_thp_size(void)
static uint32_t thp_size;
#define HPAGE_PMD_SIZE_PATH
"/sys/kernel/mm/transparent_hugepage/hpage_pmd_size"
+#define HPAGE_PATH "/sys/kernel/mm/transparent_hugepage/"
static uint32_t virtio_mem_thp_size(void)
{
gchar *content = NULL;
@@ -98,6 +99,12 @@ static uint32_t virtio_mem_thp_size(void)
return thp_size;
}
+ /* No THP -> no restrictions. */
+ if (!g_file_test(HPAGE_PATH, G_FILE_TEST_EXISTS)) {
+ thp_size = VIRTIO_MEM_MIN_BLOCK_SIZE;
+ return thp_size;
+ }
+
/*
* Try to probe the actual THP size, fallback to (sane but eventually
* incorrect) default sizes.
--
MST
- Re: [PULL 14/18] virtio-pci: Add lookup subregion of VirtIOPCIRegion MR, (continued)
- [PULL 07/18] virtio: rename virtio_split_packed_update_used_idx, Michael S. Tsirkin, 2024/09/11
- [PULL 15/18] hw/cxl: fix physical address field in get scan media results output, Michael S. Tsirkin, 2024/09/11
- [PULL 12/18] tests/acpi: pc: update golden masters for DSDT, Michael S. Tsirkin, 2024/09/11
- [PULL 08/18] intel_iommu: Fix invalidation descriptor type field, Michael S. Tsirkin, 2024/09/11
- [PULL 11/18] hw/i386/acpi-build: Return a pre-computed _PRT table, Michael S. Tsirkin, 2024/09/11
- [PULL 02/18] virtio: Always reset vhost devices, Michael S. Tsirkin, 2024/09/11
- [PULL 04/18] hw/isa/vt82c686.c: Embed i8259 irq in device state instead of allocating, Michael S. Tsirkin, 2024/09/11
- [PULL 09/18] intel_iommu: Make PASID-cache and PIOTLB type invalid in legacy mode, Michael S. Tsirkin, 2024/09/11
- [PULL 10/18] tests/acpi: pc: allow DSDT acpi table changes, Michael S. Tsirkin, 2024/09/11
- [PULL 17/18] virtio-mem: don't warn about THP sizes on a kernel without THP support,
Michael S. Tsirkin <=
- [PULL 03/18] hw: Move declaration of IRQState to header and add init function, Michael S. Tsirkin, 2024/09/11
- [PULL 05/18] pci: don't skip function 0 occupancy verification for devfn auto assign, Michael S. Tsirkin, 2024/09/11
- [PULL 18/18] hw/acpi/ich9: Add periodic and swsmi timer, Michael S. Tsirkin, 2024/09/11
- Re: [PULL 00/18] virtio,pc,pci: features, fixes, cleanups, Peter Maydell, 2024/09/13