Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3210958ybl; Mon, 20 Jan 2020 18:35:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxo5CoIzgBGGzoDuxVvkomBxG7OnfK8m6ip4lja8F9xjE+rWFr7MVcLYmdMDGRKhVUHBb8h X-Received: by 2002:a9d:24e8:: with SMTP id z95mr1956003ota.5.1579574148080; Mon, 20 Jan 2020 18:35:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579574148; cv=none; d=google.com; s=arc-20160816; b=xm5MY0tQKhozSZXww1mNN2ysMwhVRbM6+ls3FZvEz2WJbGznZmIac8dM5G+jV/GMZ7 VweaQ5IounzDWu/Zirp6U4jPH3lzy607B7a5Cvpvtkr38mwV3TFgz0EPXru+CahiBPhL jJwCCKf8zg7UDOr6z5Kr65QrVvml/S4Hv0Npcgwm/RwHN4lFgF2dulmjF5QN0iFdei5q xHQPijh0qBnh/9vjntLSKCMVD2SXMNGdFsRfygU4C/h4DCfL86rHh/6GDqqncNRN5CFy lrneaRs15izoEM7LwYSQumt9UXidsm0C1bS9WAIJHI3sy7Gel/LPaqF9j4VB/sDxM/bR DDTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=1zH8r7adTlWnnT3U9PoNpAnpyGhx4+pipOB8hZzfmEk=; b=qlzASQaCuJCflvhJiPPzg59ZtuYeTA+YqlL33801Fy2kyhMiLoJ6JE53oPwSLQopZm s6lBI/5AvoCYwnnCl6+AzPy2WFuEiYwfS0wOYlOi/IqaKvVvsCOG+pYX/9vfeUYHlsSV 17QOH0D5j3/AHP6yPs0BDFcMXjjoFnFeM0XlNixIjv2DLEricH9mah3GgOrGK/MlgHzs Yii+aFpbDCmL8FRhYti+WW0swBx1qBqhH1uuuAyRqRDswTtBreXW9Vv+O8V79ONxEmHy gVhZPa+XKrA4Bfrz0wIjB0KNNUgP65a+LHEHd5P4vkyS+tF/ifkNcXDcBAUVPvRwIgDR l0tQ== 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 u16si18786255oia.233.2020.01.20.18.35.36; Mon, 20 Jan 2020 18:35: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 S1729019AbgAUCeb (ORCPT + 99 others); Mon, 20 Jan 2020 21:34:31 -0500 Received: from mga18.intel.com ([134.134.136.126]:1658 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgAUCeb (ORCPT ); Mon, 20 Jan 2020 21:34:31 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 18:33:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,344,1574150400"; d="scan'208";a="425342745" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga005.fm.intel.com with ESMTP; 20 Jan 2020 18:33:56 -0800 Date: Tue, 21 Jan 2020 10:34:08 +0800 From: Wei Yang To: Wei Yang Cc: akpm@linux-foundation.org, yang.shi@linux.alibaba.com, jhubbard@nvidia.com, vbabka@suse.cz, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, mhocko@kernel.org Subject: Re: [Patch v2] mm/migrate.c: also overwrite error when it is bigger than zero Message-ID: <20200121023408.GA3636@richard> Reply-To: Wei Yang References: <20200119065753.21694-1-richardw.yang@linux.intel.com> <20200121015326.GE1567@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200121015326.GE1567@richard> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 21, 2020 at 09:53:26AM +0800, Wei Yang wrote: >On Sun, Jan 19, 2020 at 02:57:53PM +0800, Wei Yang wrote: >>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; > >Ok, as mentioned by Yang and Michal, only err == 0 means no error. > >Sounds this regression should be fixed in another place. Let me send out >another patch. > Hmm... I took another look into the case, this fix should work. But yes, the semantic here is a little confusion. Look forward your comments here. >> out: >> return err; >>-- >>2.17.1 > >-- >Wei Yang >Help you, Help me -- Wei Yang Help you, Help me