aboutsummaryrefslogtreecommitdiff
path: root/tests/migration
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2021-01-18 14:38:05 +0800
committerThomas Huth <thuth@redhat.com>2021-01-20 10:46:54 +0100
commitd2c4f3841d1cba17c99f76812ffcb75a6c402202 (patch)
tree338680b9d8a259330839568b545d8bca0b04d0ec /tests/migration
parent2d0fc797faaa73fbc1d30f5f9e90407bf3dd93f0 (diff)
downloadqemu-d2c4f3841d1cba17c99f76812ffcb75a6c402202.zip
qemu-d2c4f3841d1cba17c99f76812ffcb75a6c402202.tar.gz
qemu-d2c4f3841d1cba17c99f76812ffcb75a6c402202.tar.bz2
tests: Rename PAGE_SIZE definitions
As per POSIX specification of limits.h [1], OS libc may define PAGE_SIZE in limits.h. Self defined PAGE_SIZE is frequently used in tests, to prevent collosion of definition, we give PAGE_SIZE definitons reasonable prefixs. [1]: https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210118063808.12471-7-jiaxun.yang@flygoat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/migration')
-rw-r--r--tests/migration/stress.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index de45e8e..b7240a1 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -27,7 +27,7 @@
const char *argv0;
-#define PAGE_SIZE 4096
+#define RAM_PAGE_SIZE 4096
#ifndef CONFIG_GETTID
static int gettid(void)
@@ -158,11 +158,11 @@ static unsigned long long now(void)
static void stressone(unsigned long long ramsizeMB)
{
- size_t pagesPerMB = 1024 * 1024 / PAGE_SIZE;
+ size_t pagesPerMB = 1024 * 1024 / RAM_PAGE_SIZE;
g_autofree char *ram = g_malloc(ramsizeMB * 1024 * 1024);
char *ramptr;
size_t i, j, k;
- g_autofree char *data = g_malloc(PAGE_SIZE);
+ g_autofree char *data = g_malloc(RAM_PAGE_SIZE);
char *dataptr;
size_t nMB = 0;
unsigned long long before, after;
@@ -174,7 +174,7 @@ static void stressone(unsigned long long ramsizeMB)
* calloc instead :-) */
memset(ram, 0xfe, ramsizeMB * 1024 * 1024);
- if (random_bytes(data, PAGE_SIZE) < 0) {
+ if (random_bytes(data, RAM_PAGE_SIZE) < 0) {
return;
}
@@ -186,7 +186,7 @@ static void stressone(unsigned long long ramsizeMB)
for (i = 0; i < ramsizeMB; i++, nMB++) {
for (j = 0; j < pagesPerMB; j++) {
dataptr = data;
- for (k = 0; k < PAGE_SIZE; k += sizeof(long long)) {
+ for (k = 0; k < RAM_PAGE_SIZE; k += sizeof(long long)) {
ramptr += sizeof(long long);
dataptr += sizeof(long long);
*(unsigned long long *)ramptr ^= *(unsigned long long *)dataptr;