On large machines (with dozens of gigabytes of swap) it can take significant time until it completes, unless you specify "-p" parameter to set percent of total memory to use. It is difficult to find value, that would fit all setups. If the value is low, it won't exercise conditions when memory is low. If the value is high it turns into stress test, which can be swapping memory for hours. This patch adds new option '-s', which stops test if swap usage goes beyoned MBytes. By default it is 0 - no limit. For example: mtest01 -p 95 -w -s 4096 will keep allocating memory until 95% of total memory is used, or swap usage is > 4GB. This parameter is meant to be used in sanity tests, so that malloc is exercised in situations with high/low memory until system resorts to swapping, but ends when swap usage is high enough. Signed-off-by: Jan Stancek --- testcases/kernel/mem/mtest01/mtest01.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-)