Reduce blocksize in memtool to 64K
Let's see if we can hang a bit later on.
This commit is contained in:
parent
4707a8b143
commit
c6726cce28
@ -92,9 +92,10 @@
|
|||||||
# while [ 1 ]; do xxd -s $((0x1bfff0000 - 0x60000000)) \
|
# while [ 1 ]; do xxd -s $((0x1bfff0000 - 0x60000000)) \
|
||||||
# -l 4 /dev/qdma34000-MM-1; sleep 0.2; done
|
# -l 4 /dev/qdma34000-MM-1; sleep 0.2; done
|
||||||
preDeviceCommands =
|
preDeviceCommands =
|
||||||
# Run our memtool to hang the kernel here.
|
# Run our memtool to hang the kernel here. Set the maximum block
|
||||||
|
# size to 64K.
|
||||||
''
|
''
|
||||||
memtool
|
memtool $((64 * 1024))
|
||||||
''
|
''
|
||||||
+
|
+
|
||||||
''
|
''
|
||||||
|
17
memtool.c
17
memtool.c
@ -22,13 +22,14 @@ struct block *front = NULL;
|
|||||||
struct block *tail = NULL;
|
struct block *tail = NULL;
|
||||||
long nblocks = 0;
|
long nblocks = 0;
|
||||||
long nbytes = 0;
|
long nbytes = 0;
|
||||||
|
long maxsize = MAX_SIZE;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
allocate(void)
|
allocate(void)
|
||||||
{
|
{
|
||||||
long n = (long) rand() % MAX_SIZE;
|
/* Constraint the number of elements based on the maxsize */
|
||||||
/* Constraint the size */
|
long maxn = maxsize / sizeof(uint32_t);
|
||||||
n = n % MAX_SIZE;
|
long n = (long) rand() % maxn;
|
||||||
|
|
||||||
size_t size = sizeof(struct block) + n * sizeof(uint32_t);
|
size_t size = sizeof(struct block) + n * sizeof(uint32_t);
|
||||||
|
|
||||||
@ -106,14 +107,20 @@ torture(void)
|
|||||||
c = '-';
|
c = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("iter %ld, nblocks %ld, nbytes %.1fM (%c)\n",
|
printf("iter=%ld nblocks=%ld allocated=%ldK (%c)\n",
|
||||||
iter, nblocks, (double) nbytes / (1024. * 1024.),
|
iter, nblocks, nbytes / 1024,
|
||||||
c);
|
c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
if (argc > 1)
|
||||||
|
maxsize = atol(argv[1]);
|
||||||
|
|
||||||
|
printf("memtool v1.0.0 maxsize=%ldK\n", maxsize / 1024);
|
||||||
|
|
||||||
torture();
|
torture();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user