From patchwork Mon Aug 7 06:39:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13343114 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 9BB4CC41513 for ; Mon, 7 Aug 2023 06:40:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B7F06B0072; Mon, 7 Aug 2023 02:39:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 868E98D0002; Mon, 7 Aug 2023 02:39:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7306A8D0001; Mon, 7 Aug 2023 02:39:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 64BBF6B0072 for ; Mon, 7 Aug 2023 02:39:59 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0B54D1606AD for ; Mon, 7 Aug 2023 06:39:59 +0000 (UTC) X-FDA: 81096358518.01.887A4AD Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060.outbound.protection.outlook.com [40.107.244.60]) by imf23.hostedemail.com (Postfix) with ESMTP id 3A3B914000B for ; Mon, 7 Aug 2023 06:39:55 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=OSgom5mB; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of apopple@nvidia.com designates 40.107.244.60 as permitted sender) smtp.mailfrom=apopple@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691390396; 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: references:dkim-signature; bh=rEFPVFdwrxwMrKik3/BpAkixiiXNn9xLrlUwbbhmRWw=; b=4lrlFKTs/GCrahxwfT+xfuxwVpv/gR8Q0up4IFZjUbDnR+OUVUMND4yd+I6mC9MslQ8Y9v IYnVwTUseTTYbHtl6Jk8i0GAznJgSb+7XTDjmeEppaRm2rkLZJpHGHr6GOnyFKn2LjlTze SdoW+5mx7nJFMgyNw58aU9J6xoXiLRo= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=OSgom5mB; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of apopple@nvidia.com designates 40.107.244.60 as permitted sender) smtp.mailfrom=apopple@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1691390396; a=rsa-sha256; cv=pass; b=DrlyYXoLZITiH6DEGtjHMSxJrBvQ3eXk728j5Dc8HNT6rL2vm/kQ/1N6vEpf2/tPLs++qB wm1G74t1W+/NO0aUw/KXOMbAdeCIy2oeKasVfmhX8w+854eJNpxtn4eIJ0cYg5siz++2lD OymlSr/EXG7CJTjvRP96Wbg1zngPWSs= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dk67eTrWwEdWr64md9xqUvuCXJD8grbtdwrqopIv8+slL4fKE0RXEpnRrqBeO/iqCdpG59qK1ueU9B3Z2zi92jVn5px9z09iXihivqDmUNrA5SBcpip4zMcZSe0394fu5EqHe+mlRZyHBE6+bAKdnKtBN7UlqWbLUTfspLRIgZXfjwQQjTPhQz6h4ad2m60Ab50eeCuZLX1e+EIoaq2xf7IgSttGacyvpPItwllPighu0hGhabYER7SAsx1/VNQsi+cO0Etdv4wxWRvtX2yCGSgyulbxqCvgNvA7gjmnJwiTbA5rVbI3eLbFI9Lf/9g9tW8ma0E9h70CQdSl6xDLow== 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=rEFPVFdwrxwMrKik3/BpAkixiiXNn9xLrlUwbbhmRWw=; b=UOcMHkXAw9jqZtodYeI6hMR6S2RbohoiUpLaBntJEhM2JtPFnRA5vCGNwinltwahUDcUvZMOrfIIL5Tk5yHePSpCLSpiFUGhC+812xjTOzRbebEewUuudAeDoffutkmUVGH+bkqD/LtBJ/PTv1mWyiUem2ZNlmr6W/DwPEPntZk//LmC0MgDSRERzFvBrolaV7AZotevFL0J0m+cQyfMk4aC/tP6r0H3w5DpKrjYu+IQypiH3UVklB230cBRqUhbIp3M1FsPrJ07atln+tfiYhYkV3aKLDxNnv9ezjt93sseMkMaUddTTch7KLizW7mefjQ1Vb+UYMNNaL29xauOyQ== 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=rEFPVFdwrxwMrKik3/BpAkixiiXNn9xLrlUwbbhmRWw=; b=OSgom5mBaCgLfL1FLDGMAgiupg6vcJKu0xMy6WjGYMXYdMJGUMnLNF7UJ1/zpPR5R04VaTyoNMR7sHNLhH2fLU+5XxXcz0hqonz+kgGoqBs5p95BRhPdmWfRRZV3KQggWav3h/WZkcU3JqZRq3v987vUoNv9NCuHeVb+VEiU/XpmzxDOoij9K9KOsjhsByKk1g4mLq2TVEL5jmcglKjDeLLja7gX7dvWgWycqjDin5TLey/8CvurdxLStvxJjjmEwT6ZOqFztVcD9SpnDUvUmcT7M/bqE1pqZKq5h1zZkzApq5ZTocIcotsHwQAUvXQItsR9weJxhsVHk2W5Jnty7g== 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:51 +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:52 +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 1/2] mm/migrate.c: Fix return code when migration fails Date: Mon, 7 Aug 2023 16:39:44 +1000 Message-Id: <20230807063945.911582-1-apopple@nvidia.com> X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: SY5P282CA0016.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:202::12) 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: 2a84c9df-b9a5-44db-bba4-08db97111ad3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dfWEFWaX/HHbTVj3L7fxZaqr2HzdOxt4R5+KlBM1Rel0KVkhfCmEFPc5EmbhRzI40ZaurOLO4pELgjzI7vujobo62DCz11yyHuw41tUXnYq+uynBHmz/gKXI3+bdANc5OWBWC+as54KgllzlgY+sU8HFwQPbju/kTpKCn5I1pf80fXrJuohTuWQVu/c4mg0AgL6egiATtotfV5uuZi2xHvGQrd71H89K8YB6QHCSoJ9LjKg3/nZQvEu1mz/fs1BuUnVDJjHytfVR4JUp9tUiV3MDECRRj2e3X2TgTqHCgoz7cmLxu9T3bVjqt3gRW2fI6g71KHO+5ZTVgWPGQYMjAwXNOOVne8NzdOz4sKMRSM+VAWDCD8GwBDjsRmDnRCGQL6TxcZQIjm/cDI2TmFZuJw8ALUDBbi3HeniNidW2sJ4SGV+ddhZ8s43S4eJ80HlxOsqn+JRZp6X3a8kqiqzw7qRdaOKsOQc7aT3vVe/VY7zK6Rh6oI0DapKCuI66Z0m+LONUHTAEyddxzU8LIDXxaijF4qlgE651LW+HB/PYXACFF2Up40f0ehIikZo+Cgui 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-MS-Exchange-AntiSpam-MessageData-0: EHEH3cdBT9Z1v/80I74BbP6dXoGnaZdhjvtzwRjYVw79n/YEy5SdsSG91ba2lm57WyVHokcHfuGaKE7VjFK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IZh1KGqisjc1Aby4OOqeZr8ZvimGLDrZQilkmnQfbRbxadvTG0JUBMrHjxj9aZHj5Q5BfsqwFqifpwiMVIivmGuIIkVABDEQT2/bXcxWLK6JATdfy/Rw5RgR/mZf6264MquHn6GAFEGBfe50lMFf0XUPKoRZfyl8pirT6XJAyUds73lumELmjmti7ENpxfnyre7i8B77OMWlU8gyqDV+yyhpwzfSfpQRFsqK4OIljaPTVZc38RIEyt4cpPhSWkdIii2D0HiU/M1x4PTI1w9kgi6UQROIqlSeR+/vHR2TgvCdDe4mltwf7kK4VfXtaUHK/n9akbKzoEJPUlNFiEq00yc2uFY0cTNdjkLprHNd4voW+SQdDiwEwb6ZI02tKfRyTfNuCyPOx76fhEmi/lQ1nCf2L254ppMq+z9ieOiCoh/Nws X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a84c9df-b9a5-44db-bba4-08db97111ad3 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:52.6255 (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: sRF8JNvzN+bt5gKZDCEI9Et2xK7fF7wYExtO569w3qNrO7rGdVIxYcMmR9zNcL2jnreRPJlJ84g6GFulVq7g0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6779 X-Rspamd-Queue-Id: 3A3B914000B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: fi67man6sno4hgtybmcjtgrhfxwnnohs X-HE-Tag: 1691390395-375430 X-HE-Meta: U2FsdGVkX1/fnM+P8g74lTPiDtKZl4UF+QogH8ep6+gmBjqmIfa/q1ucMmT4l927tBc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9qpSI/z+IDT3fNJ0pacZUTD/+DLRpmpWOzn1BVYmzmqdqXAzyZ9SvsU/z8cW9aTPRgVJ 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: When a page fails to migrate move_pages() returns the error code in a per-page array of status values. The function call itself is also supposed to return a summary error code indicating that a failure occurred. This doesn't always happen. Instead success can be returned even though some pages failed to migrate. This is due to incorrectly returning the error code from store_status() rather than the code from add_page_for_migration. Fix this by only returning an error from store_status() if the store actually failed. Signed-off-by: Alistair Popple Fixes: a49bd4d71637 ("mm, numa: rework do_pages_move") Acked-by: Michal Hocko --- mm/migrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 24baad2571e3..bb3a37245e13 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2222,7 +2222,9 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, * If the page is already on the target node (!err), store the * node, otherwise, store the err. */ - err = store_status(status, i, err ? : current_node, 1); + err1 = store_status(status, i, err ? : current_node, 1); + if (err1) + err = err1; if (err) goto out_flush;