Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3183736ybl; Mon, 20 Jan 2020 17:54:20 -0800 (PST) X-Google-Smtp-Source: APXvYqy4Qx1VAqJwlkQ+UstQDJb0VQIbokpg02o6cavuB7cSnF6V6KUN21TmpTLFUSIuVBDrKRsE X-Received: by 2002:a05:6830:1042:: with SMTP id b2mr1848490otp.306.1579571659904; Mon, 20 Jan 2020 17:54:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579571659; cv=none; d=google.com; s=arc-20160816; b=YFFth5pIUn1qg0kR+HuOu79a5+jgJKHzYEe2X/kASKU/NZ1SZYPDtSi/UpZ8EcvLsj 94yvpU7XxsqW2/o5fkixMaQUXNDs0jb9wW+HzGxQqdOY2nK8QEoei4mx5wdocXfF7TL9 dkCFcqFfhc7AXLRltWJ+6dYutpeylPx88ZmRhinCjjeuxdc3g+Dmuf2HzzqsadMoIrjX GMFDhn1Z4bALjamLQGiWREhiCO+6PldX54SjJhWUwm+Ru3YSwn8QqLvzleXh4zU8buCo a34uPXV+Dma6PtfmHvvB1EsBP1Flc/BYR+/56R3iRPIs7kQi79dXZ8Hycx+8ihnLnuJi LOPg== 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=0hWhszvhcHYtGPYp3MNCRrY2hr1kH1/cgAFWtJkg8kY=; b=Qf4i7A9TrVHEeh3prS6hQ+/q7c2tBWnoFfujHEbC2PV+x0VFKSuA9pY+WDij9BmRn1 jntchsV9huGip9vQ27WS7AMr6tX00xcbTdjAC6B8gtDxtEfELbs+37NSU6fKi+XeQ22c cBdKinFkwosW5rVOpH3VjiMGy3ekZdTKJOTxZIxLMKNJMjQkimeaaeb7z+AYpDQgAHoY jwtAb83MpQonJQRh0d5N3o6XjZAPXJuUvRM5m+QvjBuPiA1HKTln4EYIRCuNwTjNgGLG Ez2MfiXWH/FpGGCruuoi7jg2nh2pAfjSqVYw5y6SAglB32CXntCFB1KMtEFnQJBD6zNi iUKw== 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 c19si21434397otn.7.2020.01.20.17.54.08; Mon, 20 Jan 2020 17:54:19 -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 S1728778AbgAUBxR (ORCPT + 99 others); Mon, 20 Jan 2020 20:53:17 -0500 Received: from mga17.intel.com ([192.55.52.151]:58946 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgAUBxR (ORCPT ); Mon, 20 Jan 2020 20:53:17 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 17:53:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,344,1574150400"; d="scan'208";a="220797769" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga007.fm.intel.com with ESMTP; 20 Jan 2020 17:53:15 -0800 Date: Tue, 21 Jan 2020 09:53:26 +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: <20200121015326.GE1567@richard> Reply-To: Wei Yang References: <20200119065753.21694-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200119065753.21694-1-richardw.yang@linux.intel.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 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. > out: > return err; >-- >2.17.1 -- Wei Yang Help you, Help me