Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4274332ybl; Tue, 21 Jan 2020 16:42:23 -0800 (PST) X-Google-Smtp-Source: APXvYqw4n/9mtEy7Jr+k4M7lwqjgRwro2uiv7WSNSIzLap8izlSfGX0XOpw41iDuZvINqgT8mEYr X-Received: by 2002:aca:c415:: with SMTP id u21mr5052144oif.49.1579653743277; Tue, 21 Jan 2020 16:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579653743; cv=none; d=google.com; s=arc-20160816; b=n/rtHvJCZWQxgazUig106e8uvhX1qJH1xDVU2Lvij8xOb1LLry/N5Q178JVED7So11 i3fCZuk0WShrKjZT7rN0ClUi2dYXa0ke1nU/4E/yh2K5fVODWEE+/THAQMeuf1DhqOz2 IIsbAoV7DAwburzrYfvkLMJ3jHvnOhdg0tpuvAoxKpCwbdBAoqiTXmQur/1MhBCHMjxE uLMH64OJAP2IpYchoeJr4z6P6W4XiA+Mw5ufvYpZ4aeYcF6uWa1qIkHPFBn2cmbiumIP deGnnnCGONyNd9H3oLShH7/hLG6w7mQilvIa2rl6jkBvnueD9vPYgRg6vJt9j9zhFsbp zyfA== 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=wGrVQULTFiJAIveosQiekrlquExDFIZSKRiV+bpzA+E=; b=jOrVUqnL0KKsO+EUIM/5F1OrygUPc5/KKRUkV4fIPj6YAZUYyDjlv7k4//VbxsFKrd x9FmYvx0vBgZ31vtlr6iC5F3BSn49ddSsb/7va1dGu67Y3xy5hIyINKvFZCLBSZWhiwA AuYDOsCefyJ/ghoxZdQP8FsTZxepCruF/85ga+nhKngrr1bzOBVhop8cAHzUJt/Rxyfv Oxb7wzobWb5eAIJyWDT1Huyv2SgSMTQpl+5wZ13iwhE7ZQyPhbc33bqBH6q6G30SIhSK RMSEpSjG73pX0Q31JjVUi8CwReEmb8it7YtZRXiS9KkbSYMIoQPAQTKxWMhBJ18awdLm vwZw== 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 y127si20177421oiy.250.2020.01.21.16.42.10; Tue, 21 Jan 2020 16:42:23 -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 S1728927AbgAVAk4 (ORCPT + 99 others); Tue, 21 Jan 2020 19:40:56 -0500 Received: from mga18.intel.com ([134.134.136.126]:52867 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727969AbgAVAk4 (ORCPT ); Tue, 21 Jan 2020 19:40:56 -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; 21 Jan 2020 16:40:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,347,1574150400"; d="scan'208";a="425678924" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga005.fm.intel.com with ESMTP; 21 Jan 2020 16:40:53 -0800 Date: Wed, 22 Jan 2020 08:41:04 +0800 From: Wei Yang To: Yang Shi Cc: Wei Yang , akpm@linux-foundation.org, 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: <20200122004104.GC11409@richard> Reply-To: Wei Yang References: <20200119065753.21694-1-richardw.yang@linux.intel.com> <20200121015326.GE1567@richard> <6fc3e936-eed0-eb18-ecd8-36dcc4c51218@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6fc3e936-eed0-eb18-ecd8-36dcc4c51218@linux.alibaba.com> 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 11:30:03AM -0800, Yang Shi wrote: > > >On 1/20/20 5:53 PM, 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. > >I think Michal means do_move_pages_to_node() only, add_page_for_migration() >returns 1 on purpose. > >But, actually the syscall may still return > 0 value since err1 might be > 0. >Anyway, this is another regression. The patch itself looks correct to me. > >Acked-by: Yang Shi > Thanks > >> >> Sounds this regression should be fixed in another place. Let me send out >> another patch. >> >> > out: >> > return err; >> > -- >> > 2.17.1 -- Wei Yang Help you, Help me