Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp179621ybl; Fri, 17 Jan 2020 21:27:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwgoWBb4WKn4z7cbXjC2JCDJs0udHNb/Z2MzndwULMpVSO4ITjkzODo9rFn178C5v8plR1e X-Received: by 2002:aca:be56:: with SMTP id o83mr6175827oif.25.1579325277645; Fri, 17 Jan 2020 21:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579325277; cv=none; d=google.com; s=arc-20160816; b=wMj9xVMgSinG4An3s8s6AZnPfS2CCfmb9ahjk4NScB70M/ztE8Z3OnJUlMpYWBDnv+ HjhkcEKGeXvOElwJIAyS0Au6yefuw99Jl6B/eiSpzaJNRGb1D5majd5b3umAVpD28lXu LmFnR0IYt3DFVIxUN6XicU2mY7Q/C7QkZiGwkxLGR9WS+EZvS4LWBeFMY5ix4SYtpmrg OHbzR2kq4IiSIX1FBQD1P19NS8zRO5+7SZ0WYKpEnyyuxq9UmbVcxi8jc4o3nv0mvWOI FSs04H2B0xExak7BF+/kNYfi4d5LPo+cJm045agwu98UaeUGBMkgSv7hMo2vN50nM+zR G2kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=yYEpgZOdgzFQixF64Jit5prNzzhkatIGmMbd4RBPozU=; b=LtmDP+3tkwH7EJi/4HYpmXKFwxdGXHNzQY0N+LEDMAZ+7IFqa4DrcZZWi5fkxyNXQO 9MG5dH6m/E7nk4QrI+V4xDG3BAHFTKURrAycbqSme08CVnxWAgNwGXoJcTtSMm+eLeiD sDAZw7EgcOhIeN8PlRO8dAaoSy155mqsYvnibBu14PkCjfnRwF4+K0TorycEpoV95cA5 oMQSGV10YhEmIhnZb6CmFYKWI+EcEUjeQBfAVpZukHfJLj1dDmwntoo0qeBz4WGE1ShC mZ5NV/sc2uV5BvwZHdJK9Y8PCjIxe/esQzWdy+K8we3sL0Jf7FibtZDxGRnJPhIGozce 1+jw== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si5655429otk.62.2020.01.17.21.27.45; Fri, 17 Jan 2020 21:27:57 -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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726334AbgARF0y (ORCPT + 99 others); Sat, 18 Jan 2020 00:26:54 -0500 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:44113 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbgARF0y (ORCPT ); Sat, 18 Jan 2020 00:26:54 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04455;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0To.bGaW_1579325203; Received: from localhost(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0To.bGaW_1579325203) by smtp.aliyun-inc.com(127.0.0.1); Sat, 18 Jan 2020 13:26:51 +0800 From: Yang Shi To: mhocko@suse.com, richardw.yang@linux.intel.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] mm: move_pages: fix the return value if there are not-migrated pages Date: Sat, 18 Jan 2020 13:26:43 +0800 Message-Id: <1579325203-16405-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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