OSDN Git Service

virtio-mem: Correct default THP size for ARM64
authorGavin Shan <gshan@redhat.com>
Tue, 11 Jan 2022 06:33:28 +0000 (14:33 +0800)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 20 Jan 2022 11:47:52 +0000 (11:47 +0000)
commit1263615efe51e5f1f38f4818f0de88abc33b49a6
treec31c393ffb1aa26f67f6a57db8e00673b85f0024
parent87f14eaa5198373e8716d6e71ad10d48ea2e7ec6
virtio-mem: Correct default THP size for ARM64

The default block size is same as to the THP size, which is either
retrieved from "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size"
or hardcoded to 2MB. There are flaws in both mechanisms and this
intends to fix them up.

  * When "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size" is
    used to getting the THP size, 32MB and 512MB are valid values
    when we have 16KB and 64KB page size on ARM64.

  * When the hardcoded THP size is used, 2MB, 32MB and 512MB are
    valid values when we have 4KB, 16KB and 64KB page sizes on
    ARM64.

Co-developed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-id: 20220111063329.74447-2-gshan@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/virtio/virtio-mem.c