Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1107037ybl; Sat, 18 Jan 2020 18:58:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzzIjMwDXgAjBdhNjWf94UgNJvVm1MqfNCyAs+u5UCWRUZIOyAUPS2HxE9v+sCVEwbEVvMT X-Received: by 2002:a05:6830:1607:: with SMTP id g7mr11508561otr.320.1579402711090; Sat, 18 Jan 2020 18:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579402711; cv=none; d=google.com; s=arc-20160816; b=UGDNTXUdgRw6sob/5vi+rWnFCcc4DIdiwV1PLoy3Q+yojyHOJLTcCMglJST5xJRojW RnIyYr6j+20402yAsaWEPaWhWeRAiy9WFYm2zut04GXV3R9D2T2eAoxVOvaONu8BiTiV nCnS6coCdWrv6b0+QhoHk6qQVJHDYRhstEqy2n63sdGXXzpVpCbkZ+pHj59xmo74CItR AW/QvFwgi9XT9PBWT4nJrjT/xG8L+3FpQnjDuToowF4Io8gj9KDX0UC0B93sT/uoJ3KT rySC4QQvW7vstJNRa+KdoCrM7mu7Rn+R6c0FoX2KiOO4QcMUe1yGqqe67ebHuHoYipVq wF/w== 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=W+T9FGvR2mr6Pq+2y/Yp7nkfOtKS/6YXt/7qKz4E318=; b=TTSCKP69HqTsbFy6d3ZPFBkRao/Pq/xy3OaU8F+Tj/vnSN2dlkDcR+23tZVPAMHo2j jAlHfwBwGj8TDUEKVP5xNNEbJbcPj5lKTvkbx+7gu2MjR6pUoR0kYcNPYCQAoRlF7R5a TPMS7yESX05wcOCpomzrpAlOcfWSXaDfqRNhzzFpfx9kIqU7w0L99LUlHEvhmiCatnZq FUJ1IDYGfQqL7RLxs/72gPhykkNlb+5Q28wyXjvAhWzGCTAE5YRYGQsGQMRuPJdRrZnw RO9DCJEI8T3BoMti3bE2Zfszkre0sHlbO/nf4j5iKwbizD1zKx1MfdXaDOiwSLxOLOpd 2KSQ== 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 i8si17106186otp.254.2020.01.18.18.58.18; Sat, 18 Jan 2020 18:58:31 -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 S1728689AbgASC5Z (ORCPT + 99 others); Sat, 18 Jan 2020 21:57:25 -0500 Received: from mga01.intel.com ([192.55.52.88]:62025 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbgASC5Z (ORCPT ); Sat, 18 Jan 2020 21:57:25 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2020 18:57:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,336,1574150400"; d="scan'208";a="219309692" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga008.jf.intel.com with ESMTP; 18 Jan 2020 18:57:22 -0800 Date: Sun, 19 Jan 2020 10:57:33 +0800 From: Wei Yang To: Wei Yang Cc: Yang Shi , mhocko@suse.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] mm: move_pages: fix the return value if there are not-migrated pages Message-ID: <20200119025733.GG9745@richard> Reply-To: Wei Yang References: <1579325203-16405-1-git-send-email-yang.shi@linux.alibaba.com> <20200119023720.GD9745@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200119023720.GD9745@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 Sun, Jan 19, 2020 at 10:37:20AM +0800, Wei Yang wrote: >On Sat, Jan 18, 2020 at 01:26:43PM +0800, Yang Shi wrote: >>The do_move_pages_to_node() might return > 0 value, the number of pages >>that are not migrated, then the value will be returned to userspace >>directly. But, move_pages() syscall would just return 0 or errno. So, >>we need reset the return value to 0 for such case as what pre-v4.17 did. >> >>Fixes: a49bd4d71637 ("mm, numa: rework do_pages_move") >>Cc: Michal Hocko >>Cc: Wei Yang >>Cc: [4.17+] >>Signed-off-by: Yang Shi >>--- >> mm/migrate.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >>diff --git a/mm/migrate.c b/mm/migrate.c >>index 86873b6..3e75432 100644 >>--- a/mm/migrate.c >>+++ b/mm/migrate.c >>@@ -1659,8 +1659,11 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, >> goto out_flush; >> >> err = do_move_pages_to_node(mm, &pagelist, current_node); >>- if (err) >>+ if (err) { >>+ if (err > 0) >>+ err = 0; >> goto out; >>+ } >> if (i > start) { >> err = store_status(status, start, current_node, i - start); >> if (err) >>-- >>1.8.3.1 > > >Hey, I am afraid you missed something. There are three calls of >do_move_pages_to_node() in do_pages_move(). Why you just handle one return >value? How about the other two? > Well, current logic in do_pages_move() is a little complicated to read. I did a cleanup to make it easy to read and also friendly to do this fix. If they look good to you, you could rebase your fix on top of them. >-- >Wei Yang >Help you, Help me -- Wei Yang Help you, Help me