From patchwork Sat Jan 18 05:26:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 11340031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EE85184C for ; Sat, 18 Jan 2020 05:26:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B0E320748 for ; Sat, 18 Jan 2020 05:26:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B0E320748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5EF0C6B051C; Sat, 18 Jan 2020 00:26:57 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5A10D6B051D; Sat, 18 Jan 2020 00:26:57 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B59F6B051E; Sat, 18 Jan 2020 00:26:57 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 32C386B051C for ; Sat, 18 Jan 2020 00:26:57 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id C4B30181AEF1A for ; Sat, 18 Jan 2020 05:26:56 +0000 (UTC) X-FDA: 76389620832.25.pull23_1f65b2febdd0b X-Spam-Summary: 2,0,0,8c9993efbecafcea,d41d8cd98f00b204,yang.shi@linux.alibaba.com,:mhocko@suse.com:richardw.yang@linux.intel.com:akpm@linux-foundation.org:yang.shi@linux.alibaba.com::linux-kernel@vger.kernel.org:stable@vger.kernel.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3866:3867:3874:4321:5007:6261:7875:10004:11026:11658:11914:12043:12296:12297:12438:12555:12679:12895:12986:13069:13161:13229:13311:13357:14181:14384:14394:14721:21060:21080:21451:21627:21740:21990:30034:30046:30054:30070,0,RBL:115.124.30.42:@linux.alibaba.com:.lbl8.mailshell.net-62.20.2.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: pull23_1f65b2febdd0b X-Filterd-Recvd-Size: 2178 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Sat, 18 Jan 2020 05:26:55 +0000 (UTC) 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)