Re: [PATCH] mm: move_pages: fix the return value if there are not-migrated pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
and my proposed workaround was http://lkml.kernel.org/r/20180829145537.GZ10223@xxxxxxxxxxxxxx

> 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@xxxxxxxxxxxxxxx

-- 
Michal Hocko
SUSE Labs




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux