From mboxrd@z Thu Jan 1 00:00:00 1970 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 D323DC25B0E for ; Fri, 19 Aug 2022 05:06:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C24E8D0003; Fri, 19 Aug 2022 01:06:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 671F68D0002; Fri, 19 Aug 2022 01:06:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53AFF8D0003; Fri, 19 Aug 2022 01:06:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 432AE8D0002 for ; Fri, 19 Aug 2022 01:06:11 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 176C38058B for ; Fri, 19 Aug 2022 05:06:11 +0000 (UTC) X-FDA: 79815155742.14.3DF19A7 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf25.hostedemail.com (Postfix) with ESMTP id BCD72A0010 for ; Fri, 19 Aug 2022 05:06:10 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id y18so2639302qtv.5 for ; Thu, 18 Aug 2022 22:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=yI/daoJZy1aUYv6PMGwWKM8GoZWc7pMTccjjkYejaw4=; b=ntXvLUAxrfdiUAbLWhidU4I2VdQS6twqmPFlQ4CKnhOenumibQ4ekc/58Zy+gb6SP6 zkCUNuTdWSMXOo7UsQ1SFt2hg0oxzJkXNlbRsKspf/PfCSAz60UA1nXg9MBs4PPdUojv lL5Lwr3JRg5mZHgaClbebbGdiivDRQR8F210644SAG5cNMpqOgNAXK+K39Gq6lvxVrDb HQ8na+dDfaWLqbcOd0CZhItqY6cB1WDap3a3ZNEeRFyLi3tIQyg/A6ttRlTq3R5o+0vj 4Mkh+uZa/X9sq9JdDIs4knX06H217YOs5kXnWwqEBWKpXZy6MpP4ZZ90prgVwJe3BSnY utKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=yI/daoJZy1aUYv6PMGwWKM8GoZWc7pMTccjjkYejaw4=; b=g9rS2GgEiUxvHe4txgBvEw9REUcYEOtgqdBNDbdDI2Sokh6FDs2V4m1rN21wM5S7Bu N4jCJiVEUgfam28wvCCWLJjGAMKvhN2Hgyw9yHOlwh95gMYukx83WS6Fyemt9Id3dECA zFBqWdI3ls7zqnf1u3FLc7SjhPyKRyzSsMqG9wKRJ2QxE2fazhbfwbo3MlNsZbAQSwTV b9TMPbxBHkHQN+Pa9vKYdQZ9Ru0a/bGHd2R/qIETzvzGbXskbn4GtUX/6AaNu8NyrhZt E4xdDPbzPERtUz3NXo8CDYL+IXMbD1zs6xtobAvuhW4+p15bT3pzPAeJf1D2aR0PYSIS 5Icg== X-Gm-Message-State: ACgBeo1kmwbc62wrCTw3kcQ9fasfA+8n5h2QDEzxD2nAksIsImUZ7SGC nL1SRM5l5Vjk/JnSbK0DhBE= X-Google-Smtp-Source: AA6agR6kziPNsPanO4R5DNL91dGfaSWmyNBPu2AWC92jEAptFpPOnapqUlo13MJfk/2dB6w0WLSSxg== X-Received: by 2002:ac8:5e10:0:b0:344:6932:6c11 with SMTP id h16-20020ac85e10000000b0034469326c11mr5336904qtx.420.1660885569793; Thu, 18 Aug 2022 22:06:09 -0700 (PDT) Received: from sophie ([89.46.62.64]) by smtp.gmail.com with ESMTPSA id ga10-20020a05622a590a00b003430589dd34sm2427322qtb.57.2022.08.18.22.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 22:06:09 -0700 (PDT) Date: Thu, 18 Aug 2022 22:03:58 -0700 From: Rebecca Mckeever To: "Huang, Shaoqin" Cc: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH 3/8] memblock tests: add labels to verbose output for generic alloc tests Message-ID: <20220819050358.GA3930@sophie> References: <63e9e964-021e-e141-00f8-afd7feb774fb@intel.com> <20220816023951.GB3590@sophie> <03f8614e-2bd7-afa8-6744-14397cbc9cb1@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03f8614e-2bd7-afa8-6744-14397cbc9cb1@intel.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660885570; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yI/daoJZy1aUYv6PMGwWKM8GoZWc7pMTccjjkYejaw4=; b=RiEnIA0W5kPn76o8lhMk2j2NtVS7SZDfwn/jO9D6Fq0fEvGiZAJm0Fn1S9rxbCWBeeQPBN nNgzT0fTIdGHFdhsmhcmYRUjTHFytoqdDh5itYxqX32RE3AxElrimJalNlXc3RT+f/97bk yMkRCOpzerGUg93NWc814O6pPAtkSk4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ntXvLUAx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.195 as permitted sender) smtp.mailfrom=remckee0@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660885570; a=rsa-sha256; cv=none; b=jz/m+Y5I+F4kdsD6bkBvODhPGH3WINk+ORwcN8RsmL/v4LDRxVnF34+IFso4B4FoVQ7e2v oRatZVkZV4DAhQenjEI7lpUJeg6wqjEFhYYD+iQug9xlapYT4ZJN1kCI8Cd2wM6V+TNXDt 5jolr8ZaXX5wJZZZthy/O77Qer1lhac= X-Stat-Signature: wjymu8x384fgdpoci37hzd6513roc9a1 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: BCD72A0010 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ntXvLUAx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.195 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspam-User: X-HE-Tag: 1660885570-948094 X-Bogosity: Ham, tests=bogofilter, spamicity=0.038873, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Aug 16, 2022 at 11:08:44AM +0800, Huang, Shaoqin wrote: > > > On 8/16/2022 10:39 AM, Rebecca Mckeever wrote: > > On Mon, Aug 15, 2022 at 05:15:47PM +0800, Huang, Shaoqin wrote: > > > I found original some of test function has the prefix `top_down` and > > > `bottom_up`, and some of test function didn't have the prefix. > > > > > > In this patch, it just modified these functions which didn't have the prefix > > > `top_down` or `bottom_up`, and now there are two style about these test > > > functions in the code. > > > > > > One is: > > > run_top_down(alloc_in_between_generic_check); > > > run_bottom_up(alloc_in_between_generic_check); > > > > > > Another one is: > > > memblock_set_bottom_up(false); > > > alloc_top_down_before_check(); > > > memblock_set_bottom_up(true); > > > alloc_bottom_up_before_check(); > > > > > > Thus there gonna be two output style, here is an example: > > > ok 89 : memblock_alloc_from: top-down: alloc_from_simple_generic_check: > > > passed > > > ok 90 : memblock_alloc_from: bottom-up: alloc_from_simple_generic_check: > > > passed > > > > > > ok 99 : memblock_alloc_try_nid: alloc_try_nid_top_down_simple_check: passed > > > ok 100 : memblock_alloc_try_nid: alloc_try_nid_bottom_up_simple_check: > > > passed > > > > > > It may make confuse if one is printed between the colon and one is inside > > > the function name. > > > > > > So maybe make the style consistent is more make sense. And I think this can > > > be done by modify all these function name which with `top_down` and > > > `bottom_up` inside, and replace them with your new run_top_down() and > > > run_bottom_up() functions. > > > > > So you're saying use run_top_down() and run_bottom_up() even for functions > > with `top_down` and `bottom_up` in the name, but don't change the names? > > > > Yes. We can't delete these `top_down` and `bottom_up` in the name and makes > two functions to have the same name. Due to these functions with `top_down` > and `bottom_up` have different implementation. > > If use run_top_down() and run_bottom_up() for these functions. We can get > the consistent output style, but a little redundant output(Maybe this isn't > a good idea). > Yes, I think the output would be too redundant. Even though there are two different output styles, the style is consistent within each pair of tests. So there is at least a consistent pattern. > > > On 8/14/2022 1:53 PM, Rebecca Mckeever wrote: > > > > 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 > > > > --- > > > > 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 71c89cb9b2a8..73c2c43e702a 100644 > > > > --- a/tools/testing/memblock/tests/alloc_api.c > > > > +++ b/tools/testing/memblock/tests/alloc_api.c > > > > @@ -752,10 +752,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; > > > > } > > > > @@ -774,10 +772,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; > > > > } > > > > @@ -785,10 +781,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; > > > > } > > > > @@ -796,10 +790,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; > > > > } > > > > @@ -807,10 +799,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; > > > > } > > > > @@ -818,10 +808,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 7a16a7dc8f2c..e0dd5b410099 100644 > > > > --- a/tools/testing/memblock/tests/common.h > > > > +++ b/tools/testing/memblock/tests/common.h > > > > @@ -101,4 +101,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 Thanks, Rebecca