From 5a77afa8fba649e6a91a98700d5a6ec2e5d98e9f Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 15 Mar 2019 07:49:24 -0700 Subject: [PATCH] test/bdev/raid: reduce memory usage for io_waitq unit test This test allocates ridiculous amounts of memory for certain random seeds. This test doesn't benefit from the extra queue depth, or the larger I/O sizes, so just pick more reasonable numbers that suffice for this unit test. Some of the failing seeds in the test pool resulted in >30GB of total memory allocated, according to valgrind. Eventually we need to remove the randomness from all of the unit tests, but at least this gets us past this intermittent failure. Fixes issue #692. Signed-off-by: Jim Harris Change-Id: Ia882fda8ef449c8537f76c878008aaf469ae7bd7 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448193 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Changpeng Liu --- test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c b/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c index 3d14aaf40..961180238 100644 --- a/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c +++ b/test/unit/lib/bdev/bdev_raid.c/bdev_raid_ut.c @@ -2072,7 +2072,6 @@ test_io_waitq(void) struct spdk_bdev_io *bdev_io; struct spdk_bdev_io *bdev_io_next; uint32_t count; - uint64_t io_len; uint64_t lba; TAILQ_HEAD(, spdk_bdev_io) head_io; @@ -2109,12 +2108,11 @@ test_io_waitq(void) lba = 0; TAILQ_INIT(&head_io); - for (count = 0; count < g_max_qd; count++) { + for (count = 0; count < 128; count++) { bdev_io = calloc(1, sizeof(struct spdk_bdev_io) + sizeof(struct raid_bdev_io)); SPDK_CU_ASSERT_FATAL(bdev_io != NULL); TAILQ_INSERT_TAIL(&head_io, bdev_io, module_link); - io_len = (rand() % g_strip_size) + 1; - bdev_io_initialize(bdev_io, &pbdev->bdev, lba, io_len, SPDK_BDEV_IO_TYPE_WRITE); + bdev_io_initialize(bdev_io, &pbdev->bdev, lba, 8, SPDK_BDEV_IO_TYPE_WRITE); g_bdev_io_submit_status = -ENOMEM; lba += g_strip_size; raid_bdev_submit_request(ch, bdev_io); @@ -2123,7 +2121,7 @@ test_io_waitq(void) g_ignore_io_output = 1; count = get_num_elts_in_waitq(); - CU_ASSERT(count == g_max_qd); + CU_ASSERT(count == 128); g_bdev_io_submit_status = 0; process_io_waitq(); CU_ASSERT(TAILQ_EMPTY(&g_io_waitq));