mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
test: fix bug with huge PAGE_SIZE in transition/maps008
Before this patch vma sizes were hardcoded and weren't derived from PAGE_SIZE value. But all the actions with these vmas are based on PAGE_SIZE value. That's why maps008 on PowerPC with "huge" PAGE_SIZE of 64k was simply terminating due to invalid memory access. This commit sets vma sizes to safe values derived from PAGE_SIZE. New sizes are enough to perform all the actions test does with vmas. Tested-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Eugene Batalov <eabatalov89@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
a5875ece59
commit
44c4ef842d
@@ -165,9 +165,7 @@ struct test_sync {
|
||||
};
|
||||
struct test_sync *test_sync;
|
||||
|
||||
size_t mem1_size = 1L << 20;
|
||||
size_t mem2_size = 1L << 21;
|
||||
size_t mem3_size = 1L << 22;
|
||||
size_t mem1_size, mem2_size, mem3_size;
|
||||
uint8_t *mem1, *mem2, *mem3;
|
||||
|
||||
#define CRC_EPOCH_OFFSET (PAGE_SIZE - sizeof(uint32_t))
|
||||
@@ -258,8 +256,8 @@ static int proc131_func(task_waiter_t *setup_waiter)
|
||||
|
||||
static int proc13_func(task_waiter_t *setup_waiter)
|
||||
{
|
||||
size_t MEM1_HOLE_START = 10 * MEM_PERIOD;
|
||||
size_t MEM1_HOLE_SIZE = 3 * MEM_PERIOD;
|
||||
size_t MEM1_HOLE_START = 2 * MEM_PERIOD;
|
||||
size_t MEM1_HOLE_SIZE = 1 * MEM_PERIOD;
|
||||
uint32_t crc_epoch = 0;
|
||||
|
||||
pstree->proc13 = getpid();
|
||||
@@ -346,7 +344,7 @@ static int proc112_func(task_waiter_t *setup_waiter)
|
||||
|
||||
static int proc11_func(task_waiter_t *setup_waiter)
|
||||
{
|
||||
const size_t MEM3_START_CUT = 5 * MEM_PERIOD;
|
||||
const size_t MEM3_START_CUT = 1 * MEM_PERIOD;
|
||||
const size_t MEM3_END_CUT = 2 * MEM_PERIOD;
|
||||
void *mem3_old = mem3;
|
||||
size_t mem3_size_old = mem3_size;
|
||||
@@ -395,11 +393,23 @@ static int proc11_func(task_waiter_t *setup_waiter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define MB(n) ((n) * (1UL << 20))
|
||||
|
||||
static int proc1_func(void)
|
||||
{
|
||||
uint32_t crc_epoch = 0;
|
||||
uint8_t *mem2_old = NULL;
|
||||
|
||||
/*
|
||||
* Min mem size:
|
||||
* At least 5 mem periods for mem pages and vma holes.
|
||||
* At least 1 MB mem size not to test on tiny working set.
|
||||
*/
|
||||
mem1_size = MEM_PERIOD * MAX(5, MB(1) / MEM_PERIOD + 1);
|
||||
mem2_size = mem1_size * 2;
|
||||
mem3_size = mem2_size * 3;
|
||||
|
||||
futex_set(&test_sync->datagen, 1);
|
||||
pstree->proc1 = getpid();
|
||||
mem1 = mmap_ashmem(mem1_size);
|
||||
|
Reference in New Issue
Block a user