From patchwork Sat Aug 27 05:42:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12956793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80C5BC0502C for ; Sat, 27 Aug 2022 05:43:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 190246B0074; Sat, 27 Aug 2022 01:43:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 118506B0075; Sat, 27 Aug 2022 01:43:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED578940007; Sat, 27 Aug 2022 01:43:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D85A46B0074 for ; Sat, 27 Aug 2022 01:43:12 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AB73F12072B for ; Sat, 27 Aug 2022 05:43:12 +0000 (UTC) X-FDA: 79844279424.05.C144C3B Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf17.hostedemail.com (Postfix) with ESMTP id 3A35340025 for ; Sat, 27 Aug 2022 05:43:12 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id x23so3299501pll.7 for ; Fri, 26 Aug 2022 22:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=CtDes6D1Zod3gpBKh/Yi5BXbq7xZZDBkTjW4I2nSQWw=; b=FGgwCTd0HSMlBx5pb/8Mqzyj4ZFWZ4cdvj253NkQnyBftD0w/JI4uLWzydivTmcYNi kdNOJHm6tA39hZSFyqRKtmghMKUz4w0dCWL0hhSOJ9I0YpEyA+5LYoyZBll50gIHal3s IZdnDgpXCS0VO5BhbvYqd/nPWIfG0zooA5iu9jH5L1c5aL66g4JXseqBWk8+uMliy0A/ SwuqpmPNHT/ZdbwZPskeQi0focenQrfACsAkAkinPy19wP7GMVKl/jTGR9tGWY+YAt2C 756TjNODgz+NxspuDWgPO+tNNeAoDznbwvv2sQEASnY67LtnwPeesd8BKRIZTZN6+TN/ G/rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=CtDes6D1Zod3gpBKh/Yi5BXbq7xZZDBkTjW4I2nSQWw=; b=zSZgfNCR/SlkjkBNzfCjZCKzE7p8v2OP00gv/4UQXNoTn0T0ooAe0evA+n6pCqTWp6 ID62e6XYpj1xm0Jsc5ObFtrTD5pEz4wzOfpDO/MJsTTDkuRu8Mq4c/v3FKEr1vG9feyj WTRiksqFLuwGcqeGteojelxEspTyPNL2VzoRaIVnJ6p9htc4C0kUMt3Ig7igEyss57GA DQtb8TzGKi4qEKpwJYwa51JlYj1skABDJvNuAT8L1RBQLn/tp9f9d628fVT2w8FsVDVL FNaxVvGadVY/J0+Fyn58/+jicS7lG72JHv6aiQuNOo6ThUxUMwFFCFti1O62Lqtg2xUr tzyQ== X-Gm-Message-State: ACgBeo1SM7epk3DIviCwk630C7FcuCN6SUd5uRa33uRWt3aQTkWn0/pX HcVAdFE9RZIYOgMyeJtESo8= X-Google-Smtp-Source: AA6agR77amqJBmpJQNcP8zt+Y2g7SMMDKMTqXDcZuw1SLAoPHfXtKFTdiFJ0KxOjVGomcswe62yWKQ== X-Received: by 2002:a17:90b:38c4:b0:1fd:7119:1302 with SMTP id nn4-20020a17090b38c400b001fd71191302mr4925528pjb.243.1661578991281; Fri, 26 Aug 2022 22:43:11 -0700 (PDT) Received: from sophie ([89.46.114.37]) by smtp.gmail.com with ESMTPSA id e17-20020a17090301d100b0016c9e5f290esm2658785plh.10.2022.08.26.22.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 22:43:10 -0700 (PDT) From: Rebecca Mckeever To: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Rebecca Mckeever Subject: [PATCH v3 3/8] memblock tests: add labels to verbose output for generic alloc tests Date: Sat, 27 Aug 2022 00:42:45 -0500 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661578992; a=rsa-sha256; cv=none; b=tkyC276k7Z2H36wFDkPSBnB/f+DbArW0jI1Ndyvu/80Zj0TxhNKfuUVPXSjvyZYrCY9R1O q+VseXMYxp5kNwatE8sYFRrxrQekdtAmXjBOaLW1pg/Oye3DMUUoysZ+AVZ0LFuvWdCNC9 e0boz2WgYLpcVbXWX81Rs7APUlyYrgI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FGgwCTd0; spf=pass (imf17.hostedemail.com: domain of remckee0@gmail.com designates 209.85.214.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661578992; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CtDes6D1Zod3gpBKh/Yi5BXbq7xZZDBkTjW4I2nSQWw=; b=OLpi0bSsVvQqkYPO8VbRsugpV+u/eBqTi4OiIxx9DNPDz+DxcuvLwNQlcWbSg3ybpE/9uM NU3pjEh2f438aBPQIAAwV3S/Gl0oDZ1QIiwlVPJzTVCHeALNnoPFS8FUVaCPfDIHH+1hzi fCTpWH28ZNduxlsRLJkhyWzUkeVE0tQ= X-Stat-Signature: prr3ao6mkfq8dszb1t3jh5ns8ik1j8yo X-Rspamd-Queue-Id: 3A35340025 X-Rspam-User: X-Rspamd-Server: rspam06 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FGgwCTd0; spf=pass (imf17.hostedemail.com: domain of remckee0@gmail.com designates 209.85.214.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1661578992-80222 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Generic tests for memblock_alloc*() functions do not use separate functions for testing top-down and bottom-up allocation directions. Therefore, the function name that is displayed in the verbose testing output does not include the allocation direction. Add an additional prefix when running generic tests for memblock_alloc*() functions that indicates which allocation direction is set. The prefix will be displayed when the tests are run in verbose mode. Reviewed-by: David Hildenbrand Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/tests/alloc_api.c | 36 +++++++------------ .../memblock/tests/alloc_helpers_api.c | 12 +++---- tools/testing/memblock/tests/alloc_nid_api.c | 36 +++++++------------ tools/testing/memblock/tests/common.h | 16 +++++++++ 4 files changed, 44 insertions(+), 56 deletions(-) diff --git a/tools/testing/memblock/tests/alloc_api.c b/tools/testing/memblock/tests/alloc_api.c index c97da91a98d6..de3405634f8a 100644 --- a/tools/testing/memblock/tests/alloc_api.c +++ b/tools/testing/memblock/tests/alloc_api.c @@ -751,10 +751,8 @@ static int alloc_after_check(void) static int alloc_in_between_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_in_between_generic_check(); - memblock_set_bottom_up(true); - alloc_in_between_generic_check(); + run_top_down(alloc_in_between_generic_check); + run_bottom_up(alloc_in_between_generic_check); return 0; } @@ -773,10 +771,8 @@ static int alloc_second_fit_check(void) static int alloc_small_gaps_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_small_gaps_generic_check(); - memblock_set_bottom_up(true); - alloc_small_gaps_generic_check(); + run_top_down(alloc_small_gaps_generic_check); + run_bottom_up(alloc_small_gaps_generic_check); return 0; } @@ -784,10 +780,8 @@ static int alloc_small_gaps_check(void) static int alloc_all_reserved_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_all_reserved_generic_check(); - memblock_set_bottom_up(true); - alloc_all_reserved_generic_check(); + run_top_down(alloc_all_reserved_generic_check); + run_bottom_up(alloc_all_reserved_generic_check); return 0; } @@ -795,10 +789,8 @@ static int alloc_all_reserved_check(void) static int alloc_no_space_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_no_space_generic_check(); - memblock_set_bottom_up(true); - alloc_no_space_generic_check(); + run_top_down(alloc_no_space_generic_check); + run_bottom_up(alloc_no_space_generic_check); return 0; } @@ -806,10 +798,8 @@ static int alloc_no_space_check(void) static int alloc_limited_space_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_limited_space_generic_check(); - memblock_set_bottom_up(true); - alloc_limited_space_generic_check(); + run_top_down(alloc_limited_space_generic_check); + run_bottom_up(alloc_limited_space_generic_check); return 0; } @@ -817,10 +807,8 @@ static int alloc_limited_space_check(void) static int alloc_no_memory_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_no_memory_generic_check(); - memblock_set_bottom_up(true); - alloc_no_memory_generic_check(); + run_top_down(alloc_no_memory_generic_check); + run_bottom_up(alloc_no_memory_generic_check); return 0; } diff --git a/tools/testing/memblock/tests/alloc_helpers_api.c b/tools/testing/memblock/tests/alloc_helpers_api.c index f1c7d6f170b6..06577bd0e349 100644 --- a/tools/testing/memblock/tests/alloc_helpers_api.c +++ b/tools/testing/memblock/tests/alloc_helpers_api.c @@ -357,10 +357,8 @@ static int alloc_from_bottom_up_min_addr_cap_check(void) static int alloc_from_simple_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_from_simple_generic_check(); - memblock_set_bottom_up(true); - alloc_from_simple_generic_check(); + run_top_down(alloc_from_simple_generic_check); + run_bottom_up(alloc_from_simple_generic_check); return 0; } @@ -368,10 +366,8 @@ static int alloc_from_simple_check(void) static int alloc_from_misaligned_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_from_misaligned_generic_check(); - memblock_set_bottom_up(true); - alloc_from_misaligned_generic_check(); + run_top_down(alloc_from_misaligned_generic_check); + run_bottom_up(alloc_from_misaligned_generic_check); return 0; } diff --git a/tools/testing/memblock/tests/alloc_nid_api.c b/tools/testing/memblock/tests/alloc_nid_api.c index a069534c459e..9324d706ee3a 100644 --- a/tools/testing/memblock/tests/alloc_nid_api.c +++ b/tools/testing/memblock/tests/alloc_nid_api.c @@ -1142,10 +1142,8 @@ static int alloc_try_nid_cap_min_check(void) static int alloc_try_nid_min_reserved_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_try_nid_min_reserved_generic_check(); - memblock_set_bottom_up(true); - alloc_try_nid_min_reserved_generic_check(); + run_top_down(alloc_try_nid_min_reserved_generic_check); + run_bottom_up(alloc_try_nid_min_reserved_generic_check); return 0; } @@ -1153,10 +1151,8 @@ static int alloc_try_nid_min_reserved_check(void) static int alloc_try_nid_max_reserved_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_try_nid_max_reserved_generic_check(); - memblock_set_bottom_up(true); - alloc_try_nid_max_reserved_generic_check(); + run_top_down(alloc_try_nid_max_reserved_generic_check); + run_bottom_up(alloc_try_nid_max_reserved_generic_check); return 0; } @@ -1164,10 +1160,8 @@ static int alloc_try_nid_max_reserved_check(void) static int alloc_try_nid_exact_address_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_try_nid_exact_address_generic_check(); - memblock_set_bottom_up(true); - alloc_try_nid_exact_address_generic_check(); + run_top_down(alloc_try_nid_exact_address_generic_check); + run_bottom_up(alloc_try_nid_exact_address_generic_check); return 0; } @@ -1175,10 +1169,8 @@ static int alloc_try_nid_exact_address_check(void) static int alloc_try_nid_reserved_full_merge_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_try_nid_reserved_full_merge_generic_check(); - memblock_set_bottom_up(true); - alloc_try_nid_reserved_full_merge_generic_check(); + run_top_down(alloc_try_nid_reserved_full_merge_generic_check); + run_bottom_up(alloc_try_nid_reserved_full_merge_generic_check); return 0; } @@ -1186,10 +1178,8 @@ static int alloc_try_nid_reserved_full_merge_check(void) static int alloc_try_nid_reserved_all_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_try_nid_reserved_all_generic_check(); - memblock_set_bottom_up(true); - alloc_try_nid_reserved_all_generic_check(); + run_top_down(alloc_try_nid_reserved_all_generic_check); + run_bottom_up(alloc_try_nid_reserved_all_generic_check); return 0; } @@ -1197,10 +1187,8 @@ static int alloc_try_nid_reserved_all_check(void) static int alloc_try_nid_low_max_check(void) { test_print("\tRunning %s...\n", __func__); - memblock_set_bottom_up(false); - alloc_try_nid_low_max_generic_check(); - memblock_set_bottom_up(true); - alloc_try_nid_low_max_generic_check(); + run_top_down(alloc_try_nid_low_max_generic_check); + run_bottom_up(alloc_try_nid_low_max_generic_check); return 0; } diff --git a/tools/testing/memblock/tests/common.h b/tools/testing/memblock/tests/common.h index 93e559780890..c53f9c365714 100644 --- a/tools/testing/memblock/tests/common.h +++ b/tools/testing/memblock/tests/common.h @@ -100,4 +100,20 @@ static inline void test_pass_pop(void) prefix_pop(); } +static inline void run_top_down(int (*func)()) +{ + memblock_set_bottom_up(false); + prefix_push("top-down"); + func(); + prefix_pop(); +} + +static inline void run_bottom_up(int (*func)()) +{ + memblock_set_bottom_up(true); + prefix_push("bottom-up"); + func(); + prefix_pop(); +} + #endif