Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1263328ybl; Sat, 18 Jan 2020 22:59:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxaPTbR5Lany191O8+pmKCUcYIhcmrfIqffzl1OqObkxyTB0P4JLkp5Px/dP2xdS9GZwnZb X-Received: by 2002:aca:2112:: with SMTP id 18mr8773767oiz.155.1579417188625; Sat, 18 Jan 2020 22:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579417188; cv=none; d=google.com; s=arc-20160816; b=IMB9MA2V+LK2Q43HMppr1Jd3UvcilU2+R28wJaxKubX1h2i+DHG9fzR1ayerjy1RO2 tAqmBA8e0t6e9FI3t80QeOy+75oCP5cxuSDOln9171h0HvDEsKdr+BXmF+m1rzJCYmvZ YBds5zWzyLQsogMGlerDSeky0undWVRf3DgLd/ZK0KScGKuCsU8NbKSOzGmD2ppT67V9 00Ga0xwwWqFNPvfXwKOj76L2WINJLaFtUQgJ+bwwwjEN50pE+G09FXnnnIUIz1yK88Oo kG7uaVviqjhgO0PcTujGOr39n19Im5IgjYrC2qHcwAYmQb+KU/CcsHU9Ubuo8fX3uOB/ e8Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=v9rDvcVbyQVZ/dPM8W74hxud/MCdEJM9+Skrf8LdkAA=; b=y6cEJQMLnJrSwSdyl7qXCPou8LoDs6Ug9P90WuvW47YnAQmkwDSvxElse3rv+RNI5Q iBIab9zYBUCbGZ8436frwyB49G/TJGVEqdjY0IIVrGVkp2AuN9OTLl1snCZE0LmXac0H MwFb7UA5O3W+vbPGNIgxa7zY1kA5ID1rKDqA/4uK7w8wG0dge8r3QaeYuV7Xis5379IG jmCX1rkPRUac/KM35+fWPapkpw/PPosY0qkc49/GoCnPSi6dSzcGW/bvEkgfUleS9UnY RZXVUBtF7vkwfhppgJIdHSYwLkgunEag+YfFzz6Q6u7aHVRBrHPEMPqE63xPFo79OR4G 8PBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q126si16602815oia.8.2020.01.18.22.59.37; Sat, 18 Jan 2020 22:59:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726819AbgASG5y (ORCPT + 99 others); Sun, 19 Jan 2020 01:57:54 -0500 Received: from mga14.intel.com ([192.55.52.115]:30046 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726396AbgASG5y (ORCPT ); Sun, 19 Jan 2020 01:57:54 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2020 22:57:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,337,1574150400"; d="scan'208";a="399072950" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga005.jf.intel.com with ESMTP; 18 Jan 2020 22:57:51 -0800 From: Wei Yang To: akpm@linux-foundation.org, yang.shi@linux.alibaba.com, jhubbard@nvidia.com, vbabka@suse.cz, cl@linux.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [Patch v2] mm/migrate.c: also overwrite error when it is bigger than zero Date: Sun, 19 Jan 2020 14:57:53 +0800 Message-Id: <20200119065753.21694-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we get here after successfully adding page to list, err would be 1 to indicate the page is queued in the list. Current code has two problems: * on success, 0 is not returned * on error, if add_page_for_migratioin() return 1, and the following err1 from do_move_pages_to_node() is set, the err1 is not returned since err is 1 And these behaviors break the user interface. Fixes: e0153fc2c760 ("mm: move_pages: return valid node id in status if the page is already on the target node"). Signed-off-by: Wei Yang --- v2: * put more words to explain the error case --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 86873b6f38a7..430fdccc733e 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1676,7 +1676,7 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, err1 = do_move_pages_to_node(mm, &pagelist, current_node); if (!err1) err1 = store_status(status, start, current_node, i - start); - if (!err) + if (err >= 0) err = err1; out: return err; -- 2.17.1