mirror of https://github.com/xemu-project/xemu.git
virtio-mem: don't warn about THP sizes on a kernel without THP support
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>
This commit is contained in:
parent
7fc6611cad
commit
95b717a815
|
@ -88,6 +88,7 @@ static uint32_t virtio_mem_default_thp_size(void)
|
||||||
static uint32_t thp_size;
|
static uint32_t thp_size;
|
||||||
|
|
||||||
#define HPAGE_PMD_SIZE_PATH "/sys/kernel/mm/transparent_hugepage/hpage_pmd_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)
|
static uint32_t virtio_mem_thp_size(void)
|
||||||
{
|
{
|
||||||
gchar *content = NULL;
|
gchar *content = NULL;
|
||||||
|
@ -98,6 +99,12 @@ static uint32_t virtio_mem_thp_size(void)
|
||||||
return thp_size;
|
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
|
* Try to probe the actual THP size, fallback to (sane but eventually
|
||||||
* incorrect) default sizes.
|
* incorrect) default sizes.
|
||||||
|
|
Loading…
Reference in New Issue