From: Michal Hocko <mhocko@kernel.org>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: 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
Date: Mon, 20 Jan 2020 14:17:44 +0100 [thread overview]
Message-ID: <20200120131744.GE18451@dhcp22.suse.cz> (raw)
In-Reply-To: <20200120130624.GD18451@dhcp22.suse.cz>
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
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
> 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
next prev parent reply other threads:[~2020-01-20 13:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-18 5:26 [PATCH] mm: move_pages: fix the return value if there are not-migrated pages Yang Shi
2020-01-19 2:37 ` Wei Yang
2020-01-19 2:57 ` Wei Yang
2020-01-19 5:47 ` Yang Shi
2020-01-19 5:44 ` Yang Shi
2020-01-20 13:06 ` Michal Hocko
2020-01-20 13:17 ` Michal Hocko [this message]
2020-01-21 1:44 ` Wei Yang
2020-01-21 8:40 ` Michal Hocko
2020-01-21 19:01 ` Yang Shi
2020-01-22 8:06 ` Michal Hocko
2020-01-22 17:26 ` Yang Shi
2020-01-22 17:35 ` Michal Hocko
2020-01-23 3:29 ` Wei Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200120131744.GE18451@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=richardw.yang@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=yang.shi@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).