From patchwork Wed Jan 17 18:00:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Pache X-Patchwork-Id: 13522065 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 56F95C47422 for ; Wed, 17 Jan 2024 18:00:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB7BB6B0087; Wed, 17 Jan 2024 13:00:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3FA76B0088; Wed, 17 Jan 2024 13:00:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BA786B0089; Wed, 17 Jan 2024 13:00:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 83E046B0087 for ; Wed, 17 Jan 2024 13:00:56 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4CFEC80C88 for ; Wed, 17 Jan 2024 18:00:56 +0000 (UTC) X-FDA: 81689568912.27.E2F9230 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 3D4AE10001F for ; Wed, 17 Jan 2024 18:00:53 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IY96Zqkn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of npache@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=npache@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705514454; 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=v7mWtbZkBfydRoZ1KTKCUbcKjYFh0CTp/T1jJ9CpJ+g=; b=I+awVBAGe3e2XrrNfX7qA9cnkkrocRXmCN6R9P8ys7usDsXXJ8MgBoG22QxK9AOLuFRJHT ZQmxabL/VbXLp53oOOcelkKMIAlC7eyk1GPspawTt83IVF+d0ERAxjwJhmDCFvcMFAtZj/ 7v1CQYGo0m6sZZeAYn0IsVgcFk6RzG4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IY96Zqkn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of npache@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=npache@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705514454; a=rsa-sha256; cv=none; b=FEdV6pjMCiQqSJJL/dmK71yuDbMS4QChi4HGq6J3nm16uwp6XXrFY1NDyIC684hPRkzZNa EmODAGSNyaK2Pnb+hNSPObB80nBCRt7X1dxY4s+U6xLBjoRefdS+HOri95ir2GHqS3eWnB dYJDqxqewladGhMwomipjJCpCfoRIqY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705514453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=v7mWtbZkBfydRoZ1KTKCUbcKjYFh0CTp/T1jJ9CpJ+g=; b=IY96Zqknb/zt68wz8zxx9kSGusPMXF9/vFt6FpcYhFsq/auXZMPBFZfr9Bjaw+TEVIIRiv nFMJ5D1rcotmNKOfcm+XW10qjqDdFhqlMk410IA0GcvlHd7rvYPkBraUDy6LXpSnhfat/z RjPGSgyFdUFe9mtsAlbrSLnl8pW+lj0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-346-RXAB2irYP0KW7RzaKLEjpw-1; Wed, 17 Jan 2024 13:00:49 -0500 X-MC-Unique: RXAB2irYP0KW7RzaKLEjpw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E76851C18CD3; Wed, 17 Jan 2024 18:00:48 +0000 (UTC) Received: from localhost.redhat.com (unknown [10.22.34.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AADA492BC6; Wed, 17 Jan 2024 18:00:48 +0000 (UTC) From: Nico Pache To: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, shuah@kernel.org Subject: [PATCH] selftests: mm: Perform some system cleanup before using hugepages Date: Wed, 17 Jan 2024 11:00:37 -0700 Message-ID: <20240117180037.15734-1-npache@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Rspamd-Queue-Id: 3D4AE10001F X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: wzd3ehnnjusg94u48fcr1yqy1jpc4qnb X-HE-Tag: 1705514453-364304 X-HE-Meta: U2FsdGVkX18erHIfSJtTCD3DUxb6DkgN/qi3O0+/N+ygZMgtfKS0kvkrShNERHR9SHRyF59g9K3Je3bbWb7AOU4Ecgc+a7E7V1JyWH/skSZ0S2gS/RckvNw1CVrAst5GKZMpRFMSwb7LC98g931p94JNu95fm+bXPquG4ekDN7q8OHZ6Yt0vgLIOnebyLxjnSwNsbNyDgk8sU39ZbgCBFSmvomcImFf5OxihilD1JLp0wXL9rac/ie9fed8w9Dq8LrrZ7PsH3yGJ3iaUOnm9xkWOStUgHGc77rMpG9ne+8TxMQdSBYhFZsFp3IKiFcD3mYGsZ/pIDkPFGP8CVLhwz/kfYHjn1Aixf278TUqPGY7QFVfOHumiTIu2l9cB1yRCLEN5XZingq+iByoNvzhug0H1uJgOY2BFueVpnugjJnkuNCgvAJA6yQViV9MtyHbw21PbwiwVZBye9GtEzfeICQxerOZtAVKz8m+3PBW6DjSrRsgA1WbHekzSj+3h+bTTblwqlk9GRdcNoEpyDlnLzv6v3/sY8yb0cYXt2TIG4LWCsWzMkFjfDi+mJ9QCzWsMznJgYznVWZJ9/uIIwp6UOTSRRK9ZhGSSKJrVX511+Kx79/HuFZbxl6LKnT8xHqT++w6rS3YomKvMSQZWpF0JS2TBnm+6niG3NMzFT3PcJplsSapfzXWhngiR0mGxaFvODeI6S3gKUtx7Q9+/OIBTDGmhRWKOqPE6sz4jsQfa6ribzo0izct25kLQodKoDfxWvDFXyYO/zuec41DG360cXp7WNUl/0j1vKxHjebb9S1Nx7LN1wTMhpgYvy2Pk3yqVvXtSGv6kZr7awghhGajZtREXkfzT8jU05ZVwiaEaGMpUNX1tFv0nyr1lMnlhjXZAKvzJM9AXAveMb41Ia3ru9k+dmsG2k3lsp7T0A7cBHh7KIbSW4tnMHoYhl/wJPdSpmcPfAgDfEkPoME9sN/Z cSM4V40l 92xLmJm0c1fPiahgLxygSJwrIPflRJTs0JIIq1kZL+4w09eWgpJavsyIf0zDkYYQtp63wHjNxkbMDtQR9LKGjB7bf2JpVgiYJ0+ZVzBmwuzCX4FIB2sPN85EdWN9fPZm9V/nllMpSfGfyqP2H4n6ZqUPDoXF1hqW7rLIjwgpnTUpU1as= 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: List-Subscribe: List-Unsubscribe: When running with CATEGORY= (thp | hugetlb) we see a large numbers of tests failing. These failures are due to not being able to allocate a hugepage and normally occur on memory contrainted systems or when using large page sizes. drop_cache and compact_memory before the tests for a higher chance at a successful hugepage allocation. Signed-off-by: Nico Pache --- tools/testing/selftests/mm/run_vmtests.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 246d53a5d7f2..040f27e21f47 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -206,6 +206,15 @@ pretty_name() { # Usage: run_test [test binary] [arbitrary test arguments...] run_test() { if test_selected ${CATEGORY}; then + # On memory constrainted systems some tests can fail to allocate hugepages. + # perform some cleanup before the test for a higher success rate. + if [ ${CATEGORY} == "thp" ] | [ ${CATEGORY} == "hugetlb" ]; then + echo 3 > /proc/sys/vm/drop_caches + sleep 2 + echo 1 > /proc/sys/vm/compact_memory + sleep 2 + fi + local test=$(pretty_name "$*") local title="running $*" local sep=$(echo -n "$title" | tr "[:graph:][:space:]" -)