From patchwork Fri Aug 9 10:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dev Jain X-Patchwork-Id: 13758681 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 7BF08C52D7C for ; Fri, 9 Aug 2024 10:32:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EA656B0098; Fri, 9 Aug 2024 06:32:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09ACF6B009A; Fri, 9 Aug 2024 06:32:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA4846B009C; Fri, 9 Aug 2024 06:32:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CFEBA6B0098 for ; Fri, 9 Aug 2024 06:32:37 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8A4FC1A0C8B for ; Fri, 9 Aug 2024 10:32:37 +0000 (UTC) X-FDA: 82432343154.03.ECB4EB9 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf30.hostedemail.com (Postfix) with ESMTP id E324880019 for ; Fri, 9 Aug 2024 10:32:35 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf30.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723199491; 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; bh=sFXhh648nndX5eKnDKkGLK3WTPnegS5ZW4xE+814tng=; b=GH8HfHsBsvYHF6GMw3ortpLLNWO9hw9YtBiOinxQc4jH8UrxMP8f7PW75GFtSCF0hoFxQ1 7cSTLzKAVuEg+B6IVNV6w+YMGI5LLCnTS3b/82m1SZEJ7SZji2ukRR5/0/n7Ca2Ruwvy63 jnzxrEmdAo66klu5cogHMRxRok7KmD4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723199491; a=rsa-sha256; cv=none; b=U0sktI9WAvadFrHpFDzGaenM84mzkSyKFULIr9fL+aLLt0gEiECXeZjhnZilZbK1kHyl+W +K6/gB/MiSGPdeai2JH91nMEz+WNZ4tBIgaPxXnjy+ajCFHi+MX3AF65sNyyJmNd58Z4dN TbV9+Npjl26XurkJrT7lrkqmVDtlpVU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf30.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BC37613D5; Fri, 9 Aug 2024 03:33:00 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.42.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A366D3F766; Fri, 9 Aug 2024 03:32:21 -0700 (PDT) From: Dev Jain To: akpm@linux-foundation.org, shuah@kernel.org, david@redhat.com, willy@infradead.org Cc: ryan.roberts@arm.com, anshuman.khandual@arm.com, catalin.marinas@arm.com, cl@gentwo.org, vbabka@suse.cz, mhocko@suse.com, apopple@nvidia.com, osalvador@suse.de, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, will@kernel.org, baohua@kernel.org, ioworker0@gmail.com, gshan@redhat.com, mark.rutland@arm.com, kirill.shutemov@linux.intel.com, hughd@google.com, aneesh.kumar@kernel.org, yang@os.amperecomputing.com, peterx@redhat.com, broonie@kernel.org, mgorman@techsingularity.net, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Dev Jain Subject: [PATCH 2/2] selftests/mm: Do not fail test for a single migration failure Date: Fri, 9 Aug 2024 16:01:29 +0530 Message-Id: <20240809103129.365029-3-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809103129.365029-1-dev.jain@arm.com> References: <20240809103129.365029-1-dev.jain@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E324880019 X-Stat-Signature: en6ttphujssp7dyzz7wiw9czkjrsts6c X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1723199555-61037 X-HE-Meta: U2FsdGVkX1+Z/4kBw5y8Gr4QhzJQaVDozsRl8Mh/Me4FnMD5PHrS2QlKmUTVvgv8Qi6EysbjWAO8OBoqITtXSd2KUQADFSWa+QgbHvUiBMq1R9hX9oaY12oXBUVt0W9jWoq3S7Hkm9ZbgwvfdixbQTOsu1NN4n7gIqBsBe04mPZAZoUDVONlpvla+yIP/WHxmP9tGuDmFftgLO75Eg/mhefbwl+wMSkDK95BlSATb2CeWK4bqYmCFlYsJI2+lB0yPtZ//0RozGqPEegqWn7tlqQOBK3iA10w/cfWlLWf0KNPYHmw3Q0yUF3H+JGkrN0rwapP+k1SaxO2ZZ6q3pRVJdi4+mppWyJiQJZeDqh288XcZ+KnfsMJR23m0JnpKFNYpH2o+dMTgVCvrkgWlGW0GX7oDVaTFMxZVwhwhJsBkAGQmeQQE1ziqlIAzujU1LrUxVCo/bOFJV6cyfz9sugG4xUNBikW5/1m8rYBMknAM9bhKDcSZ9BViCLvSIfcQJH6ECp/qIInAtd+xrX08Lcpx82wqOSGtCF8oMRQj8dhakzGhKN/xmmcCDnygYMQes0iYlc5v0jCL0KU0AjFIXAjrQN/0iLSWTiEc1HOCf9f4kMyk+ox0E6Hgo6gZm8+he1rG2zECwY8Tyeq6bJRqxV0otaO+dhTgnSjRAQbGkPAVU8CesKlVn/hYPKis4aMCleoDfDQBpy8cVfowxBLBesVhNuTk6Z/sm/rO0jM2ZUEyHJfOagAtqhtkWKvqszy9x83czjEBsd+RdMGhgzdEXvmpzi7sJrrbr23tXpVItTYNfRthRR0ZacEGKIPIliDEg31E+Dbi1bTVylICiNVZXTSeHFOzLY+gCHiILxepb+VmxFn+577La1JkhvXFqEDF9Rn1n7cmGv72kVfQxGkMYhcO1rufh71Sxez3kQe2o5MH2xq9Z46xjwTSxeGOXgKTvVS4PRhJF1NEQ7QbScSNEs auQB7TzG ueZhxlMIITaSgxM1WDD6FUCy6QMPeQGUsDOv5aU4Wq80KyAwg86C+IvSyrB2QC3NF8Gh+cF9KyEj8wd85t8Ai49oxIeQX//qWKAA0PXqmy8jpjNEWUcohng1AtV9QhmSHo3eaur1wrviytV0R5k2aznFfyh1iwTEjNH4qac/Bw+eVR1CAIqsaPrPdXFYCLhVNlApBlCA5GfZWaJ8= 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: Do not fail the test for just a single instance of migration failure, since migration is a best-effort service. Signed-off-by: Dev Jain Suggested-by: David Hildenbrand Reviewed-by: Ryan Roberts Tested-by: Ryan Roberts --- tools/testing/selftests/mm/migration.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/mm/migration.c b/tools/testing/selftests/mm/migration.c index 6908569ef406..64bcbb7151cf 100644 --- a/tools/testing/selftests/mm/migration.c +++ b/tools/testing/selftests/mm/migration.c @@ -15,10 +15,10 @@ #include #include -#define TWOMEG (2<<20) -#define RUNTIME (20) - -#define ALIGN(x, a) (((x) + (a - 1)) & (~((a) - 1))) +#define TWOMEG (2<<20) +#define RUNTIME (20) +#define MAX_RETRIES 100 +#define ALIGN(x, a) (((x) + (a - 1)) & (~((a) - 1))) FIXTURE(migration) { @@ -65,6 +65,7 @@ int migrate(uint64_t *ptr, int n1, int n2) int ret, tmp; int status = 0; struct timespec ts1, ts2; + int failures = 0; if (clock_gettime(CLOCK_MONOTONIC, &ts1)) return -1; @@ -79,13 +80,17 @@ int migrate(uint64_t *ptr, int n1, int n2) ret = move_pages(0, 1, (void **) &ptr, &n2, &status, MPOL_MF_MOVE_ALL); if (ret) { - if (ret > 0) + if (ret > 0) { + /* Migration is best effort; try again */ + if (++failures < MAX_RETRIES) + continue; printf("Didn't migrate %d pages\n", ret); + } else perror("Couldn't migrate pages"); return -2; } - + failures = 0; tmp = n2; n2 = n1; n1 = tmp;