Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4311751ybl; Tue, 21 Jan 2020 17:31:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzXN6VMEfysd5LKA+tes/c+O+3WCtCWOP2ShQDiGkN6V+f/kYWcTbCTbKwZqum0xAAsUUaV X-Received: by 2002:a05:6830:1691:: with SMTP id k17mr5818340otr.282.1579656663070; Tue, 21 Jan 2020 17:31:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579656663; cv=none; d=google.com; s=arc-20160816; b=iNRpn85LP24J7U7I1ImPB8/++qLQ197+plElF3TMTZTZwmK2Ri/zI2BTIzOEM8USlu DvoOAOKpAMZpDc+J2pzYgPG3iDbyGOSVn7yqprqKBcoCLpzXz9ufSZ5fgg0ecIFDiN/V XxKrdHVBy7QqifB+rChJ3K+1AtQsgx0x1kFjjZIBG3s2+nScRMTVZaeJbGr0yJlGHaz7 8g7B6jNwSS51Nrr1WVrHVwmz88s2ANTqju0OeylkS1vaBsySdNZRUEQzhy4SyF3w6U5s CNv+0d65mFMhPEU0MJdiPxy0HxvNldZ1z3c8Kx3I5ER8976+Mv6D25SMg9UmeOLizV+n UXlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GOsVGA+e6lWAqdty5MZjpW+zrB0icJdGldsGprNf1U0=; b=V4T/HkTIvb+cfhDaIDgD02XaJwrJEPinaHYsAmEj/fsX9b3HRLrKxHeAAnQn1p1YMD iK4OqBQ3Gd7hhHzt/IPnnVVPQFG3ruQ4WI9R8DIUiuRAqY8I/ffSrcsUwtrZ0/Htp5qK DLYQFQBce2pjRcAdZQOPHrzqoIaEM/FfbBR8HTh9/yG31IPWvizRAsFZAasBOvYLtJvN PE0FQM++Qmmx8NeQGVtmV0hnXVXhwhGUXHahOytqDARWesqeY735qXadS60e+NmPqQXp 7W8imJhVbnj4Dmhc1S4+13IXaH1g8Ib1VnI99SDTxP9FsaUUjm6/mD9i3MMIKr8aa3uw 8a+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=cDiniTyc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si22018655ota.103.2020.01.21.17.30.50; Tue, 21 Jan 2020 17:31:03 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=cDiniTyc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728901AbgAVB3w (ORCPT + 99 others); Tue, 21 Jan 2020 20:29:52 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:2239 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728750AbgAVB3w (ORCPT ); Tue, 21 Jan 2020 20:29:52 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 21 Jan 2020 17:29:07 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 21 Jan 2020 17:29:50 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 21 Jan 2020 17:29:50 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 22 Jan 2020 01:29:50 +0000 Subject: Re: [Patch v2] mm/migrate.c: also overwrite error when it is bigger than zero To: Wei Yang CC: , , , , , , References: <20200119065753.21694-1-richardw.yang@linux.intel.com> <20200121015326.GE1567@richard> <20200121023408.GA3636@richard> <0aa42c19-4144-5c7a-10f5-162b1b068d4c@nvidia.com> <20200122004222.GD11409@richard> X-Nvconfidentiality: public From: John Hubbard Message-ID: <9acef3fe-4c9a-6ecb-daa0-767d98f572ae@nvidia.com> Date: Tue, 21 Jan 2020 17:29:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200122004222.GD11409@richard> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1579656547; bh=GOsVGA+e6lWAqdty5MZjpW+zrB0icJdGldsGprNf1U0=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=cDiniTycwJ9K//ViCZhktNCV2VcgVU+asgOagiziHmo0y2snA+bY6JiUF8DTPOYYE +bGw2bX8Uxo8myaIF1RlZhu1eXSkG2lAvodls1uXorDnyEZl4H47yOOndV/Pbchwns KBIj9z3i3RsS7g2HfWa2soZfjMPCeBb4kF00pNMbG+80FG450d2z0Z8gLglwr9Oxzf Icq6bxSPgmDv2URTRMc9ym0ykeFALJFQ3o0sE9wnlnM3HFVODNLXoHm3upW4VBPN/o u9nO/cR/moClGZBu8+R6xfI16oFI9yYIBOB6FO4zaYDeAsJwWyHDRoFI53vt0WNH93 oY4u3sa7/E+SA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/21/20 4:42 PM, Wei Yang wrote: > On Tue, Jan 21, 2020 at 11:33:16AM -0800, John Hubbard wrote: >> On 1/20/20 6:34 PM, Wei Yang wrote: >>> 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"). >> >> The Fixes tag should be different, right? Because I don't think that >> commit introduced this problem. > > This is the correct one. > > Before this, we don't return 1 from add_page_for_migration(). > OK, then. :) thanks, -- John Hubbard NVIDIA >> >>>>> 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 >>> >> >> thanks, >> -- >> John Hubbard >> NVIDIA >