Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3177582ybl; Mon, 20 Jan 2020 17:45:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxyXVBEBVu6TK+VdHavSHLoEt6+inSa3puTNpR0tGx+Fqu/QOGJddft98dpyU+3D5G/E/on X-Received: by 2002:a05:6808:251:: with SMTP id m17mr1289499oie.15.1579571119617; Mon, 20 Jan 2020 17:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579571119; cv=none; d=google.com; s=arc-20160816; b=bVJs0eOPBltD68pKIwikugHa4yqrwCYUxv5gv4AAS327np9Hm0pbyQsc+Y60iOUL73 gMV2r1pc5QPipTQiRH7qA9/pFJep95CSzRHij/PzHKIGr7Xu/MMbYdAsJ/3Q2jVnGq45 zasBw/8qCujz0C6noiZRl20c0FJRgSZP07+tzfbPtEm726f9DdwnyfEvkm8V/X3xKqv5 ZVmTovoRKQJ+bY9zcCRu+Cz8LZbkqCsa9bICX4KxFbMZJNuijBWrfvAjRY3aBkTyEtB6 zliFwuOTOCc8wHYfdAZGYn7i4klnog2wb0GQRJtN/bzgB5S0G90RakAEF1AXMwT29Yy+ Jhzg== 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=v4v2Z/XMSZXdh9yZTt75dtLojexPN8scG6s+VvnmmGQ=; b=bTVkemGJ8WDutnLQfaLuvhA5OOZbS6aQdHOryNW1s3pn12rfXT2Zot6VA5b18a32Bi LbwrsUB6Kaj2t6wUoEn7XpBmQgKcMtepJE330KQx76lZK0PQY99mzeUXUzmsP8CTE3f+ eI/5j+JYZvVKW8Oxk/OucZM+SBc+ssUw6t7hjup/gGIXNBt850xfudEUdFfpIewAaRxX yG4BxUKKbbeHh6MnSb6z7JrivIRkNtJPUPtOR9qzFLkfG3tW0sIVpTW24yiU8W9DZthD fDZZpXbQCLQcYCLUGHsYoYozbLELaYPixXaAqVCOjaneZgkImUwi+9o3KXqn0lsgDJBU c+aQ== 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 v67si19956564oia.26.2020.01.20.17.45.07; Mon, 20 Jan 2020 17:45: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 S1728916AbgAUBoJ (ORCPT + 99 others); Mon, 20 Jan 2020 20:44:09 -0500 Received: from mga18.intel.com ([134.134.136.126]:63155 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726935AbgAUBoI (ORCPT ); Mon, 20 Jan 2020 20:44:08 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 17:44:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,344,1574150400"; d="scan'208";a="307056935" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga001.jf.intel.com with ESMTP; 20 Jan 2020 17:44:05 -0800 Date: Tue, 21 Jan 2020 09:44:16 +0800 From: Wei Yang To: Michal Hocko Cc: Yang Shi , richardw.yang@linux.intel.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: <20200121014416.GC1567@richard> Reply-To: Wei Yang References: <1579325203-16405-1-git-send-email-yang.shi@linux.alibaba.com> <20200120130624.GD18451@dhcp22.suse.cz> <20200120131744.GE18451@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200120131744.GE18451@dhcp22.suse.cz> 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 Mon, Jan 20, 2020 at 02:17:44PM +0100, Michal Hocko wrote: >On Mon 20-01-20 14:06:26, Michal Hocko wrote: >> On Sat 18-01-20 13:26:43, 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. >> >> The patch is wrong. migrate_pages returns the number of pages it >> _hasn't_ migrated or -errno. Yeah that semantic sucks but... >> So err != 0 is always an error. Except err > 0 doesn't really provide >> any useful information to the userspace. I cannot really remember what >> was the actual behavior before my rework because there were some gotchas >> hidden there. > >OK, so I've double checked. do_move_page_to_node_array would carry the >error code over to do_pages_move and it would store the status stored >in the pm array. It contains page_to_nid(page) so the resulting code >indeed behaves properly before my change and this is a regression. I Thanks, I see the change. >have a very vague recollection that this has been brought up already. ><...looks in notes...> >Found it! The report is >http://lkml.kernel.org/r/0329efa0984b9b0252ef166abb4498c0795fab36.1535113317.git.jstancek@redhat.com >and my proposed workaround was http://lkml.kernel.org/r/20180829145537.GZ10223@dhcp22.suse.cz Well, the above two links return 404. > >> If you want to fix this properly then you have to query node status of >> each page unmigrated when migrate_pages fails with > 0. This would be >> easier if the fix is done on the latest cleanup posted to the list which >> consolidates all do_move_pages_to_node and store_status calls to a >> single function. > >Sorry forgot to put a reference to the patch: http://lkml.kernel.org/r/20200119030636.11899-5-richardw.yang@linux.intel.com > >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me