From patchwork Mon Aug 7 06:39:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13343115 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 D34AFEB64DD for ; Mon, 7 Aug 2023 06:40:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F9C36B0074; Mon, 7 Aug 2023 02:40:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A9368D0002; Mon, 7 Aug 2023 02:40:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4234E8D0001; Mon, 7 Aug 2023 02:40:04 -0400 (EDT) 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 351676B0074 for ; Mon, 7 Aug 2023 02:40:04 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 03DA81206D8 for ; Mon, 7 Aug 2023 06:40:03 +0000 (UTC) X-FDA: 81096358728.27.50FAD4D Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2062.outbound.protection.outlook.com [40.107.244.62]) by imf28.hostedemail.com (Postfix) with ESMTP id 3F6CEC0008 for ; Mon, 7 Aug 2023 06:40:00 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Q4lrh2Qe; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf28.hostedemail.com: domain of apopple@nvidia.com designates 40.107.244.62 as permitted sender) smtp.mailfrom=apopple@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1691390401; a=rsa-sha256; cv=pass; b=2Yt9P6Mf0jFJ1tUVGWHdXyMq1RtTaAyB9vsb/8+s87/Lu+HffVRrCi0UlwZYqf+riA3vh0 4OzMMH9Z86B4AjzDRuCy7NNB37WfzPbUoQouDBlwH5eQj8KTx/FJZGosQ1Y3OVnqvceBUg eivxmilcJB6YUIW7YwmNc9lUY2nlPeE= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Q4lrh2Qe; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf28.hostedemail.com: domain of apopple@nvidia.com designates 40.107.244.62 as permitted sender) smtp.mailfrom=apopple@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691390401; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=efCB74BJHWmaOyUfSAR0E9XaVvufPYFlyr9gltn6RIs=; b=lQaCKaPB1iC0S2xZs+bbDQFtLic2SdAqBkMJAP+qOqfNwWfV1cPYhQuIagLqIvV9MexlTR sZx98f/ghhjWbJAHzcbz6HSQf3+x18w29YwMET/6qRCrSUjqGCiHVmAZcwhGmOvLGQQrlg g4Q0EbzbcUUM8BO3bJwDRoD1lEBjGkw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZAVrb9RavHT4rz72AJqwqIRUnVaUQI3L4m9D92osFRkC+SxDcr2KAd5HDstRzN8HBpgqFPcCxqZdsZXPMxOJl8X/S0YBYbf+aqSBBK2TxgJOPeD0mz6+UJdpFvSxY0Ayvc3ZbTBKlHeU5DHKwXpNxGhvibLwMS3mPACnwZq8czT35aK3oDLTbMisMnb+lKbZ1DspSNhl1UzuPozIPs6n8J/Hbm3zyi7CweyDUuLxrba8mWMe0fSvYMY/ITPGaOmYpa2Nq6MTiXAARXeKYwBV/Xq5fokWz44g8GEwAzw+l58WwEw9t0IPuACKE9p/831LzzoXoliPriZuP19wuOv8xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=efCB74BJHWmaOyUfSAR0E9XaVvufPYFlyr9gltn6RIs=; b=EsF6XtykJA0/IJQUPUzkClIpGjYEP34M2x2K7/o/QdYQc9gOW765MJlwHCr8VKH5DQUUbKdVkOwbmQ7yfMoB9RK7ssOcX1nlSiXBQmp6lep5h7ok7LSaQWJOdJ/3UAnT00RQ4XNKa2WCFPbPTE4BiSnBYNo1w9QEv7SRA7o0MfjcKjUEVSS/uAf+fg8bP6Abwu0GcC0rK6xWEvyOHKhnVw/5mahxpBF+FAvlrLo9EsuwfjikLlQZhtD/+nWrzkGLjBR74ezs6jZ/26K9pMLiCz14ammN9fDGMaC0ivUoJlFDCh/dnIvi6ZXHI9eoby0uDuEh4O97ZpXfxvKbL/fV7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=efCB74BJHWmaOyUfSAR0E9XaVvufPYFlyr9gltn6RIs=; b=Q4lrh2QeJmj43tfRftdhNkWMY7k081X1VPqjdFnv337iqBNHmDzzL3jlm/QBJwSRIUzkWxl5qhSrc8M7U5769j61be+nddNc6s5hAJRAc48PABs4VwVv+wtJtYJLOGudmIPj56UaJZSScjf41SKJSlaFiZjgIRMDWQcQ4WSJDkxQzpa0OP8lItzxs2iasKWABOikhJGk4SJTNVrL97V1aowcCOw/A9r8pqHxzrcdxvKsX5XUA+90/xvIbMjF9WA63XZxkHMhvQgfCm+/zr6kagFF51iaJfgKK2Wk0CaquYgLn67Eem8WSHT22eJq4XvPQqFYzW9dtyt9IJJVctZ00g== Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by MW4PR12MB6779.namprd12.prod.outlook.com (2603:10b6:303:20f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 06:39:56 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::df45:7f28:ee84:b0b2]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::df45:7f28:ee84:b0b2%6]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 06:39:59 +0000 From: Alistair Popple To: Andrew Morton Cc: linux-mm@kvack.org, mhocko@suse.com, jhubbard@nvidia.com, ying.huang@intel.com, osalvador@suse.de, baolin.wang@linux.alibaba.com, ziy@nvidia.com, shy828301@gmail.com, ryan.roberts@arm.com, Alistair Popple Subject: [PATCH 2/2] selftests/migration: Disable NUMA balancing and check migration status Date: Mon, 7 Aug 2023 16:39:45 +1000 Message-Id: <20230807063945.911582-2-apopple@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230807063945.911582-1-apopple@nvidia.com> References: <20230807063945.911582-1-apopple@nvidia.com> X-ClientProxiedBy: SY0PR01CA0011.ausprd01.prod.outlook.com (2603:10c6:10:1bb::8) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB3176:EE_|MW4PR12MB6779:EE_ X-MS-Office365-Filtering-Correlation-Id: fde6c2e2-0f93-4cde-cdc1-08db97111ec1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d2AXeqUp2lbGzXR1gk7MkLGWAB+hHhane/MDteLXDFw+QLaxQtFH4hOR+MWDJJpvcq/TGzKfxlOm9pP+PB3uSqBL21dE554tk0AJy8OcsTDcWuxk98LArqlAPH15XLgXIpY3DHMNuFzDFK6cYF0XGgsMA+tE0Hk+A3a2sWUvCRow6xSIzYWNjgK7zMHQNT2+ZdKh80NUpZjxbJUmwXWd6p3HGBvbGUwK2S5M/Kb5Dj6yD3kxkC9JqG9Rcgqy/gIEOvi2mq5C6Xcx0323OfA05OPRp4LDwFMShWkGnj9PmBBkbi3HxBY2h0/LT3fAVuYsEELwi9redQwOqCjaRmWChyAZGyC04c4I/9NtOr+5pDMgf8VaFsCWGhdJ5D3b0MZJRgc1Fi77WblS0yidUlwpeEekCZvDdpux3fxMDbAkiZRmtU8UI2lw6z5u2QHeLHnfdjfRxbHskxHe12D28eU2hNo2BZSrxNmIgedZdzKqlyBSG3Icu7hx6/tFqsEZoy0ze6Q2+fZStGqo+C9lEPany0kV478Ew4y6XVRIYl9Z3xm/sZ+Thi02jygwWhrxDfBk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3176.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(39860400002)(346002)(136003)(396003)(366004)(186006)(1800799003)(451199021)(1076003)(41300700001)(26005)(107886003)(2906002)(5660300002)(83380400001)(8676002)(8936002)(2616005)(6916009)(86362001)(316002)(6506007)(38100700002)(6486002)(66476007)(66556008)(478600001)(66946007)(6666004)(6512007)(4326008)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X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fNcKh88uw10Aq6We/oPaBupzcEqJ11dZa6Drwi5fFMIX7qj9zqbe+l0J2Yp/jdzkEsiX6vBVguFLPZoTI9V0FrhVyFaatzJ9+ESJZZTX0IzXlPqhS9ZnAO9kI6wbHzrIVgCTI+pZbWMJcGD56L3Kk3ugUc2J83qt4TqwLsewirUig47uaNcTmK1gtIOm+CGbHf+HJG2OZnADCpZVT3dFekGA7LHKl2M1HWEQqCNtj6Yj8W3HSJNfUq5hjcJrq0Q6OiW3Zhnv0zCSEbm8jGdhKez2p3izZ+QjT9t8gl0GOWDSbvLYJRgr6QtdWSbi/ZxbubGkWItRg/G4r5WsmlwGDSPrTFEEEi4kgf4eTdRPsQz4dTd5WYRzoZNWdSvnL4h6YvZFJ3xbfyIEwwE8JEgEwlOQ3f5yzrqkIbdhlyGBZpUA1kHn/Ammjne5La+PU5WDjdlH+rQRI6yBZwLBsWg3Vcqcq6cdFCV/Qr4FusnCl8oc388q4EFLgF0n2E5aAvFcyAvuuMRynq8lgQDL9yadmPm X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fde6c2e2-0f93-4cde-cdc1-08db97111ec1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 06:39:59.0662 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AqhvzAi0nxRB7ZOh3G1WOQgNmnnUFRieFIjvu/gelCpqdzaXT41+fPfeoyfr47J9dVFsyOymdikKxg2JrKL0jw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6779 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3F6CEC0008 X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cvpd/4vB/e7j81OLChCf3Eg7+yf2PMliwefikS7qWhuFIGuzkQgeegynnlj6AowcBnLyXLYM+ju3GmpHehKKfNq511zTEwqlU1ZQoFnCFdddbZRcuyWJF4e89ENelGm9m12PrQ8CbiZhogYW7Oh1OTEjnAsxUwNejlDue/KknuqVpKaSxERKglQFoEvF/zqGiPkT4SX59uaPoic3/tMD9DJTvN/vcsx/QVbZNPL+4QMKK+SiF6E7Twrt/TyD4dqg== 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: The migration selftest was only checking the return code and not the status array for migration success/failure. Update the test to check both. This uncovered a bug in the return code handling of do_pages_move(). Also disable NUMA balancing as that can lead to unexpected migration failures. Signed-off-by: Alistair Popple Suggested-by: Ryan Roberts --- Ryan, this will still cause the test to fail if a migration failed. I was unable to reproduce a migration failure for any cases on my system once I disabled NUMA balancing though so I'd be curious if you are still seeing failures with this patch applied. AFAIK there shouldn't be anything else that would be causing migration failure so would like to know what is causing failures. Thanks! tools/testing/selftests/mm/migration.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/migration.c b/tools/testing/selftests/mm/migration.c index 379581567f27..cf079af5799b 100644 --- a/tools/testing/selftests/mm/migration.c +++ b/tools/testing/selftests/mm/migration.c @@ -51,6 +51,12 @@ FIXTURE_SETUP(migration) ASSERT_NE(self->threads, NULL); self->pids = malloc(self->nthreads * sizeof(*self->pids)); ASSERT_NE(self->pids, NULL); + + /* + * Disable NUMA balancing which can cause migration + * failures. + */ + numa_set_membind(numa_all_nodes_ptr); }; FIXTURE_TEARDOWN(migration) @@ -62,13 +68,14 @@ FIXTURE_TEARDOWN(migration) int migrate(uint64_t *ptr, int n1, int n2) { int ret, tmp; - int status = 0; struct timespec ts1, ts2; if (clock_gettime(CLOCK_MONOTONIC, &ts1)) return -1; while (1) { + int status = NUMA_NUM_NODES + 1; + if (clock_gettime(CLOCK_MONOTONIC, &ts2)) return -1; @@ -85,6 +92,15 @@ int migrate(uint64_t *ptr, int n1, int n2) return -2; } + /* + * Note we should never see this because move_pages() should + * have indicated a page couldn't migrate above. + */ + if (status < 0) { + printf("Page didn't migrate, error %d\n", status); + return -2; + } + tmp = n2; n2 = n1; n1 = tmp;