From patchwork Sun Sep 4 04:21:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12965117 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 2736AECAAD5 for ; Sun, 4 Sep 2022 04:21:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F1438017E; Sun, 4 Sep 2022 00:21:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A0AD8015A; Sun, 4 Sep 2022 00:21:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 667E38017E; Sun, 4 Sep 2022 00:21:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 55B718015A for ; Sun, 4 Sep 2022 00:21:26 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 21EAFC0BF7 for ; Sun, 4 Sep 2022 04:21:26 +0000 (UTC) X-FDA: 79873103772.11.872EDDA Received: from mail-oa1-f67.google.com (mail-oa1-f67.google.com [209.85.160.67]) by imf16.hostedemail.com (Postfix) with ESMTP id C6BC018005D for ; Sun, 4 Sep 2022 04:21:25 +0000 (UTC) Received: by mail-oa1-f67.google.com with SMTP id 586e51a60fabf-1273a47cdb6so620655fac.13 for ; Sat, 03 Sep 2022 21:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=oKN0F2PyDgbdZaFzj41LoA7okbsSnk9gGkmccD+LQ/0=; b=cCXpX5fp3tpUw+L3qqOgXlPPeNrEh3FWRwQiGh1Dg65httdY9RBLvhGnzgnEYW0PPG gBvZ3vYT+wOsL1j4SsYfe35OcMvBhyI5UdqAwiTJsSy8M80ullkjy+a/V5Yf7By4Fu0d PubkFnLxhSg+0Rtm9WF3AJgjkGZgd8di03IHyUetaEU+J6LUhNXjVDGUrK1rgLT8zREL wwY4TGP0fbovJXpVsm13y9o90YcmIpG8ehCyHI+Q2MIsfuREh6XGJbqFsH5Mn5giNH7O gUBVg+5pjjs3hqoZHM8/J3hLtneMFXOgMFndpqwxAlpdHQM8pxoTmVcOrSEkzccACG16 cxLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=oKN0F2PyDgbdZaFzj41LoA7okbsSnk9gGkmccD+LQ/0=; b=xBk8ZOphNOlRrVBjK2e9jhmuBPHbbhy0O2YeVk+mcVP3WnFcGK8ZfZqbcuM8Cmhcjs p2kmlMGQ7hFir6ikOi4Hu9nPUAEkZwbJOQCFZlY+ntwWuvukMxFNrGr2zHWnDiTyqF0E iGB1ILCEnMTeYhCCZ2jWWMs/CE8Iabk23BhAA2uiy++Jnv5QaGlJnhdqtwOGbd0eg29J fnQuCfmtNAS3uCGsChWY8+LeLHD/PvLzbHt5Hz9E/JvT5ATcaQaj+bWc9nytYBlGdmc7 /BW1k5mX6G+LqvkH98o8BRHDel0IBgvp8PmWK42hJ7hq2/N2rRYOHJMHBU4j+w4p+ZOA PYSQ== X-Gm-Message-State: ACgBeo3BuATy/Ro77jZL6EArp9RMUIFc0l8w7GfIepSkM9i/A1hUZhBt kacydIue2mh+T561yFqchaw= X-Google-Smtp-Source: AA6agR7x4Sw1UPMP3L6uAgwOWz2fX1nFh9r2LZoAxSDsfEBzhX91E3ZBSixPlCJwGVob2QioO3ZkSg== X-Received: by 2002:aca:b05:0:b0:343:53bf:3221 with SMTP id 5-20020aca0b05000000b0034353bf3221mr5002679oil.75.1662265284891; Sat, 03 Sep 2022 21:21:24 -0700 (PDT) Received: from sophie (static-198-54-128-109.cust.tzulo.com. [198.54.128.109]) by smtp.gmail.com with ESMTPSA id a7-20020a9d5c87000000b0063736db0ae9sm3086645oti.15.2022.09.03.21.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Sep 2022 21:21:24 -0700 (PDT) From: Rebecca Mckeever To: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Rebecca Mckeever Subject: [PATCH v4 0/4] memblock tests: add NUMA tests for memblock_alloc_try_nid* Date: Sat, 3 Sep 2022 23:21:04 -0500 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662265285; a=rsa-sha256; cv=none; b=e3jyfy6Hj/D/qP6JvbZw570Pu7+uWVMd7s/uZ2qBgBzbifeoCt+/rrDBK17EyOdIZ3ixpb IBimXy7aBtAUs7TlS9noMrA+iCpenkHewJbOlo+kf7G0aws0niBsmRqzeGdoi6l3ABglk7 P7GRMhJO6cnAu63X+FO202PslRH1xYY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cCXpX5fp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.67 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=1662265285; 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:references:dkim-signature; bh=oKN0F2PyDgbdZaFzj41LoA7okbsSnk9gGkmccD+LQ/0=; b=2hiltbm0N6Z23/0TLcbkSMr4Rs4mT3nBs4IxmXXWBj67t2e6PxmDUEAd1OGrDBVsfwOnuP 1SR2BTBDEbTmNr5QQOGb+4wke9J759P8m8ZaFdiK/m/QRbTnBMzUXyq5K2zy/b5TN5TELg UM17hELMDI+0y30qAjMmAaiqIWrmCwc= X-Stat-Signature: b5j1ucjx91uxfaen6ast7yr87knb8n9c X-Rspamd-Queue-Id: C6BC018005D Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cCXpX5fp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.67 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1662265285-544106 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These patches add additional tests for memblock_alloc_try_nid() and memblock_alloc_try_nid_raw() that use a simulated physical memory that is set up with multiple NUMA nodes. Additionally, most of these tests set nid != NUMA_NO_NODE. To set up a simulated physical memory with multiple NUMA nodes, patch 1 introduces setup_numa_memblock(). This function uses a previously allocated dummy physical memory. It can be used in place of setup_memblock() in tests that need to simulate a NUMA system. These tests are run twice, once for memblock_alloc_try_nid() and once for memblock_alloc_try_nid_raw(), so that both functions are tested with the same set of tests. When the tests run memblock_alloc_try_nid(), they test that the entire memory region is zero. When the tests run memblock_alloc_try_nid_raw(), they test that the entire memory region is nonzero. --- Changelog v3 -> v4 Based on feedback from David Hildenbrand: PATCH 1: - tests/common.h: + Remove #define MEM_FACTOR PATCH 2: - tests/alloc_nid_api.c: + Add missing blank line after alloc_nid_test_flags = flags; PATCH 2, PATCH 3, PATCH 4: - tests/alloc_nid_api.c: + Define variables in new tests in a single block + Change "cleared memory region" to "memory region" in comment blocks for new tests Based on feedback from Mike Rapoport: PATCH 1: - tests/common.c: + Remove node_sizes[] array - tests/common.c, tests/common.h: + Combine setup_numa_memblock_generic() and setup_numa_memblock(): * Remove setup_numa_memblock(void) * Change setup_numa_memblock_generic() to setup_numa_memblock() and remove the factor and node_cnt parameters * Change nodes[] parameter to an array containing the denominators of the fractions of MEM_SIZE contained in each node e.g., if nodes[0] = SZ_8, node 0 will contain 1/8th of MEM_SIZE PATCH 2: - tests/alloc_nid_api.c: + Add node_fractions[] array: * Based on values from node_sizes[] array previously in PATCH 1 * Update to fit the new nodes[] parameter of setup_numa_memblock() v2 -> v3 PATCH 2, PATCH 3, PATCH 4: - tests/alloc_nid_api.c: + Edits for consistency between tests and test naming styles: * Change "numa_top_down" to "top_down_numa" * Change "numa_bottom_up" to "bottom_up_numa" * Move "generic" to immediately before "check" * alloc_try_nid_bottom_up_numa_small_node_check() and alloc_try_nid_bottom_up_numa_node_reserved_check(): - Separate size definition from its declaration Updates based on changes to the dependent patch set noted above: PATCH 2, PATCH 3, PATCH 4: - tests/alloc_nid_api.c: + get_func_testing(): * Rename to get_memblock_alloc_try_nid_name(). + Update calls to verify_mem_content() to assert_mem_content(). v1 -> v2 Updates based on changes to the dependent patch set noted above: PATCH 2, PATCH 3, PATCH 4: - tests/alloc_nid_api.c: + Update calls to verify_mem_content() to include the flags parameter required by the new, common verify_mem_content() function. --- Rebecca Mckeever (4): memblock tests: add simulation of physical memory with multiple NUMA nodes memblock tests: add top-down NUMA tests for memblock_alloc_try_nid* memblock tests: add bottom-up NUMA tests for memblock_alloc_try_nid* memblock tests: add generic NUMA tests for memblock_alloc_try_nid* .../testing/memblock/scripts/Makefile.include | 2 +- tools/testing/memblock/tests/alloc_nid_api.c | 1459 ++++++++++++++++- tools/testing/memblock/tests/alloc_nid_api.h | 16 + tools/testing/memblock/tests/common.c | 29 + tools/testing/memblock/tests/common.h | 22 +- 5 files changed, 1515 insertions(+), 13 deletions(-)