* [PATCH] KVM: selftests: do not require 64GB in set_memory_region_test
@ 2021-07-01 16:04 Christian Borntraeger
2021-07-02 6:49 ` Zenghui Yu
0 siblings, 1 reply; 2+ messages in thread
From: Christian Borntraeger @ 2021-07-01 16:04 UTC (permalink / raw)
To: Shuah Khan
Cc: Paolo Bonzini, Zenghui Yu, kvm, linux-kselftest, linux-kernel,
linux-s390, Christian Borntraeger, vkuznets, wanghaibin.wang
Unless the user sets overcommit_memory or has plenty of swap, the latest
changes to the testcase will result in ENOMEM failures for hosts with
less than 64GB RAM. As we do not use much of the allocated memory, we
can use MAP_NORESERVE to avoid this error.
Cc: Zenghui Yu <yuzenghui@huawei.com>
Cc: vkuznets@redhat.com
Cc: wanghaibin.wang@huawei.com
Cc: stable@vger.kernel.org
Fixes: 309505dd5685 ("KVM: selftests: Fix mapping length truncation in m{,un}map()")
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
tools/testing/selftests/kvm/set_memory_region_test.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c
index d8812f27648c..d31f54ac4e98 100644
--- a/tools/testing/selftests/kvm/set_memory_region_test.c
+++ b/tools/testing/selftests/kvm/set_memory_region_test.c
@@ -377,7 +377,8 @@ static void test_add_max_memory_regions(void)
(max_mem_slots - 1), MEM_REGION_SIZE >> 10);
mem = mmap(NULL, (size_t)max_mem_slots * MEM_REGION_SIZE + alignment,
- PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
TEST_ASSERT(mem != MAP_FAILED, "Failed to mmap() host");
mem_aligned = (void *)(((size_t) mem + alignment - 1) & ~(alignment - 1));
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: selftests: do not require 64GB in set_memory_region_test
2021-07-01 16:04 [PATCH] KVM: selftests: do not require 64GB in set_memory_region_test Christian Borntraeger
@ 2021-07-02 6:49 ` Zenghui Yu
0 siblings, 0 replies; 2+ messages in thread
From: Zenghui Yu @ 2021-07-02 6:49 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Shuah Khan, Paolo Bonzini, kvm, linux-kselftest, linux-kernel,
linux-s390, vkuznets, wanghaibin.wang
On 2021/7/2 0:04, Christian Borntraeger wrote:
> Unless the user sets overcommit_memory or has plenty of swap, the latest
> changes to the testcase will result in ENOMEM failures for hosts with
> less than 64GB RAM. As we do not use much of the allocated memory, we
> can use MAP_NORESERVE to avoid this error.
Had a go on arm64:
Tested-by: Zenghui Yu <yuzenghui@huawei.com>
Thanks,
Zenghui
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-02 6:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 16:04 [PATCH] KVM: selftests: do not require 64GB in set_memory_region_test Christian Borntraeger
2021-07-02 6:49 ` Zenghui Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).