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: 188914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:30f:b0:101:a8e8:374 with SMTP id ia15csp80493dyb; Wed, 17 Jan 2024 10:01:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsuboDZgeBChO9ipYn3O0NwCsil6E05fhpAAGOm/hyQ/IUv26p2QYYG/+Ow/3oug8vMFsQ X-Received: by 2002:a05:6214:f21:b0:67f:89da:aa8c with SMTP id iw1-20020a0562140f2100b0067f89daaa8cmr12811484qvb.115.1705514470232; Wed, 17 Jan 2024 10:01:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705514470; cv=pass; d=google.com; s=arc-20160816; b=or91ueL8XxvKp251RWsr7K9DEMjA5A/rKRFwOrV6LNKE/+fPxxTDO2SJFZaCXxTjCW tzNTLo709iiY8rAk8cFoPBDB1n7GSgE1f/UMqwl1rHfIUS7ZfZOmwORV6ba1IgZvPHXo Otu2IyVw7qhMqYbw5jDQ/2Pdmy7s6mvFi//BmBloBzVQebDQ4Ncm5ZW262sv+oyu84Rt NNsNTvrjQ7vz5KV/+ul+jmSKxhKjsfM8Ytr4Wf8vr3wG5G30ScImfAWdOs6FrDGi8gmB QVZoOBwsSrsXfrmaUcclT19BxJlqgqPqYBSTFOT6YrJhOBsmLTQcu24iF7ohK37pZNNZ daXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=v7mWtbZkBfydRoZ1KTKCUbcKjYFh0CTp/T1jJ9CpJ+g=; fh=0e9qypsG9fZy/kAvV0hgfXz47+yJ3CcZB/4xbyXy/74=; b=kquDPOd+/nbIeY+LpwkJWRXRNlV6Z76px5Iqxhwi83cvlM9q39hC1/9dxCct91ITQX s3enZwgkAhUI0lUSpVPmIfms4WQfev1gbKLb7XF8l+CdKRJsuIRS+rAVHSxlT07d7ykI f89CWO3X50taRdeg9bq4ArfPp1GVvm/gH9UuVL0HD0Sgr4A8yIAGOQN3wK7m0GD8JPsC YMF87KC3uLj0i0L0EfMxDSM2e6tXaHjlbv+b6dXBR3/RQT/3+cioUTldmz35zKYUcg4R oZjYe/LNeCgTR7cn3R1WTyuYP67TSFxUkOZUPyf0CgZ5FGiA1qtFd7mVUOmb984hDQeF WwzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hayWYpGZ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-29299-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29299-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k1-20020a0cb241000000b006804ee562c8si12324317qve.454.2024.01.17.10.01.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 10:01:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29299-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hayWYpGZ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-29299-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29299-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 09DBB1C21026 for ; Wed, 17 Jan 2024 18:01:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FC5222F0E; Wed, 17 Jan 2024 18:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hayWYpGZ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DAAD22635 for ; Wed, 17 Jan 2024 18:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705514454; cv=none; b=WYLxJIz8u1juE6zjfcyVMo+F8VQqlXfqwB1cYql9Kk167UXQBf5vYNV5vAUq11mzJvUx8Hvb2/8VtJ8ssTce/ifAfcDKCQywXqYXClX2pWi8R8LsfBiwsmLe9VG2OdsbVd9PlB1ObmkW+7LB/xK+EM5nUx4iBB5LnN17w3wMWso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705514454; c=relaxed/simple; bh=8IXAWHXrSjNXM0FpElCzk0WtxnO106w/8hSLLnHdKKc=; h=DKIM-Signature:Received:X-MC-Unique:Received:Received:From:To:Cc: Subject:Date:Message-ID:MIME-Version:Content-Transfer-Encoding: X-Scanned-By; b=AYmly08yeJA/f4vRYnt+MHJvFIrWPE3mmm0YBk8b1J57tJuJlQz9fEq8PGmGLy327Q9VpRahNnV6MSkmQce5vDeP2NJFn3XW1EgdqCzi2V2/DAMbaHzItFoDkuzehcsao79qF6vHBN4xkvHnSsqliQ6L4PLKACcvyhOhN/2WWxo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hayWYpGZ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705514451; 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=hayWYpGZna3WrmdhcZPNADL1KR8MdzedixDojumMecmc5zha+wWxbSMNe8i198O59kPcly FomO4OR7JsWaiyOn08H2uoIGUrlSQVZ0dIam9rfhR3UmgWOPTwPYI8XuNwSoW8q9qlqTtS zap26jITBAGdzSSeBCSRjlt/jh+KizQ= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788361540827477050 X-GMAIL-MSGID: 1788361540827477050 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:]" -)