From patchwork Fri Aug 19 08:34:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12948540 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 9D6E5C25B0E for ; Fri, 19 Aug 2022 08:44:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1C0C8D0003; Fri, 19 Aug 2022 04:44:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCB858D0001; Fri, 19 Aug 2022 04:44:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6C268D0003; Fri, 19 Aug 2022 04:44:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 955FE8D0001 for ; Fri, 19 Aug 2022 04:44:37 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5E9D8160741 for ; Fri, 19 Aug 2022 08:44:37 +0000 (UTC) X-FDA: 79815706194.03.B51F24D Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf03.hostedemail.com (Postfix) with ESMTP id 517E72001B for ; Fri, 19 Aug 2022 08:44:02 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id c9so1704790qkk.6 for ; Fri, 19 Aug 2022 01:44:02 -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=/AuZh6/EXSH4csd9kXJqbNQ5qfX/45Zmq2NrwoQlhOA=; b=UQp6NnGxVUdhiACYjgNV9DX95HS5blr4xke/sutLdPm+vXMaThK7VmVkT6mWU4Ch7p 49BrJhLa5Z5xG+kGpMfwmWkqSmhtkaFoXXjXxIMLLqnwCFQPFkUnH/Qr/bh1n8seqksr O7Jk1yuvfCp5R6B1P1P25I+w5EOVDm10mqlg6cs2Sr2OsjwEP+yuCSZOxntOu6jeQdW0 iz+/eWus/uOVZ4PqkosN2ja1fXKHazn1WyUhSIsDe0Tlq4m8eOd6th+TjcIxZqmxMrub Y3AUvBRRlhR7mTZKNJXqQ/D4KekqRe2VB/jxkGxep1YNtYtKlgllph4XtIlVOyfVfSpI vR/g== 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=/AuZh6/EXSH4csd9kXJqbNQ5qfX/45Zmq2NrwoQlhOA=; b=IgiGkGiYgPHaFeIMCxmrp5tYGlkoyaUyO33ECsS0GYNMWMayMuvIE5dRNs0/YTtgIZ rQpvSDD9moFemSQZx7H65JH4UD8sFCa9PBd/OiALoCTzFLR1XRMvg2jDmhHf9fzXNKMw 6UtmXDXitl6mAVn36DiFzr0u7s+AefXbB/HMLn9+xVJ0NVr6GJmZlm8RSphfuCWFPLBZ qRKyOHLMZuGSodIW69TjEe4WjR3+QD/U466txXLhEB1/fFKlMJYt0hQWUOct2BqhJaZ2 hl6CV6jQ79RZt5e6MaDbo5t9G5olXjPSpwe1czRyjnKDOWAl+qFzf2hEoAnUsHCmKmPI UY7w== X-Gm-Message-State: ACgBeo2fsEQ5FmgLli4DfAp5hzYSom65gpy6XQ2b1XURPoEiTCesAqLd MMXiFjnZBS24bCCq44zzZPPkcBeEdQ0= X-Google-Smtp-Source: AA6agR6mMCUz+yGW+fRODy/h7mLgQjqFYADzX2efdHIXyhGeBpHCWvxfi3CqauZM+dU6X51Dal0vrg== X-Received: by 2002:a05:620a:4588:b0:6bb:50d4:7f7d with SMTP id bp8-20020a05620a458800b006bb50d47f7dmr4424643qkb.244.1660898641587; Fri, 19 Aug 2022 01:44:01 -0700 (PDT) Received: from sophie ([89.46.62.64]) by smtp.gmail.com with ESMTPSA id s13-20020a05620a254d00b006b633dc839esm3464833qko.66.2022.08.19.01.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 01:44:01 -0700 (PDT) From: Rebecca Mckeever To: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Rebecca Mckeever Subject: [PATCH v2 3/8] memblock tests: add labels to verbose output for generic alloc tests Date: Fri, 19 Aug 2022 01:34:51 -0700 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=1660898642; a=rsa-sha256; cv=none; b=Pqudl9Cq7FL3rEJQq/iIgWSgNskOgRY55Y7cLa4FGoSR3mwlYYt4CFS/pRgmDwPfaBxxMY WXHAAnRqFZO/TA1VdE5G5aAmgfXh58od7W/9MnkLcpYGbBs577tFbYeT+EByd7B6Rw5TGX ssedIVw1/nh+gj31565kg8dlqTMVLBU= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UQp6NnGx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of remckee0@gmail.com designates 209.85.222.195 as permitted sender) smtp.mailfrom=remckee0@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660898642; 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=/AuZh6/EXSH4csd9kXJqbNQ5qfX/45Zmq2NrwoQlhOA=; b=GK97u+Rp8EE1ZTYeBqVSclkrDLk+//1Ybg1wEbljf4l0oE0wRpU6S9sZuyx4Z7TbIT7/xP mK4gNzfVXj3YNJBXcc/7dgQ5ZCy9NS7gx/rjcvAHkrPNVpNrnzFTXq4ykTkN+USKjLEOaT Mv12tjGvABBpCpUJKqJDq614We1/uVM= X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: cddd1bjmmjrceoggpo3xxrf3bxqiijhh Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UQp6NnGx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of remckee0@gmail.com designates 209.85.222.195 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspamd-Queue-Id: 517E72001B X-HE-Tag: 1660898642-464789 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000040, 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. Signed-off-by: Rebecca Mckeever Reviewed-by: David Hildenbrand --- 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 aefb67557de9..6a9c8e788cac 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 796527cf3bd2..1ccf02639ad6 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 71b7beb35526..82fa8ea36320 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 29756e652e3e..58f84bf2c9ae 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