From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77028C352A4 for ; Mon, 10 Feb 2020 09:36:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 43B0621739 for ; Mon, 10 Feb 2020 09:36:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43B0621739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E137B6B00D7; Mon, 10 Feb 2020 04:36:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC2F16B00D9; Mon, 10 Feb 2020 04:36:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD86E6B00DA; Mon, 10 Feb 2020 04:36:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id B29066B00D7 for ; Mon, 10 Feb 2020 04:36:38 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3EEC2181AC9C6 for ; Mon, 10 Feb 2020 09:36:38 +0000 (UTC) X-FDA: 76473712476.20.hot64_39e220ad0be1d X-HE-Tag: hot64_39e220ad0be1d X-Filterd-Recvd-Size: 5325 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 09:36:37 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id m16so6645835wrx.11 for ; Mon, 10 Feb 2020 01:36:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gSMBBgHYZjC32JQ2hZUg1g8OrBnMTL0dXFRwmZKq0Uo=; b=aHQ0omyRHBJB5N76WmHtPJ6di4FMGa+1lBehUaQWEuuSWVlsG5TNQS1yRRTImKlQ3R Hloi96Ucd/fwdTpaBF/jkGJMFnJzws0qofgvjyFnoRglD+Rxhi5/ru9wN9rOFvQSVVV7 kKA1ZrHJuJtME79svQucYb5qMcHHXekHM/bnp5M8j2WCKYQi5O9QyJZQoq/kkgQOU/8F f8Jt5iLM4fZSvVEX3EzhkFTwCisUDLh0vIG4PV+wU0JaK3W6ug6y9g/IpeOmRMnmYj2R d3OxC5ZUIQV5dkbBHexFfoj1xfPtF50IWtRpdGhtpymVFezFNZvXI5YXjM6zFKLn1XWq WVNg== X-Gm-Message-State: APjAAAWUCnrkgQE+5q5AMdqhAc+EI5MbploZg2ODhEi+dF5PeDFiV+Yy fPl7sBednnet7MHqLG10Q58= X-Google-Smtp-Source: APXvYqzBpDvO5UNjtlf1RA9l7ko2o8/X6t/yRDDNfp3gd6fhIMrMsZSORLVs9mN0H4gOPEXruR4kag== X-Received: by 2002:adf:f8c8:: with SMTP id f8mr883083wrq.331.1581327396641; Mon, 10 Feb 2020 01:36:36 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id x10sm15044242wrv.60.2020.02.10.01.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 01:36:35 -0800 (PST) Date: Mon, 10 Feb 2020 10:36:35 +0100 From: Michal Hocko To: Yang Shi Cc: mtk.manpages@gmail.com, david@redhat.com, akpm@linux-foundation.org, linux-man@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v3 PATCH] move_pages.2: Returning positive value is a new error case Message-ID: <20200210093635.GC10636@dhcp22.suse.cz> References: <1580757507-120233-1-git-send-email-yang.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1580757507-120233-1-git-send-email-yang.shi@linux.alibaba.com> 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: On Tue 04-02-20 03:18:27, Yang Shi wrote: > Since commit a49bd4d71637 ("mm, numa: rework do_pages_move"), > the semantic of move_pages() has changed to return the number of > non-migrated pages if they were result of a non-fatal reasons (usually a > busy page). This was an unintentional change that hasn't been noticed > except for LTP tests which checked for the documented behavior. > > There are two ways to go around this change. We can even get back to the > original behavior and return -EAGAIN whenever migrate_pages is not able > to migrate pages due to non-fatal reasons. Another option would be to > simply continue with the changed semantic and extend move_pages > documentation to clarify that -errno is returned on an invalid input or > when migration simply cannot succeed (e.g. -ENOMEM, -EBUSY) or the > number of pages that couldn't have been migrated due to ephemeral > reasons (e.g. page is pinned or locked for other reasons). > > We decided to keep the second option in kernel because this behavior is in > place for some time without anybody complaining and possibly new users > depending on it. Also it allows to have a slightly easier error handling > as the caller knows that it is worth to retry when err > 0. > > Update man pages to reflect the new semantic. > > Cc: Michal Hocko > Cc: Michael Kerrisk > Signed-off-by: Yang Shi Acked-by: Michal Hocko > --- > v3: * Fixed the comments from David Hildenbrand. > * Fixed the inaccuracy about pre-initialized status array values. > v2: * Added notes about status array per Michal. > * Added Michal's Acked-by. > > man2/move_pages.2 | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/man2/move_pages.2 b/man2/move_pages.2 > index 1bf1053..50c83a4 100644 > --- a/man2/move_pages.2 > +++ b/man2/move_pages.2 > @@ -104,7 +104,9 @@ pages that need to be moved. > is an array of integers that return the status of each page. > The array contains valid values only if > .BR move_pages () > -did not return an error. > +did not return an error. Pre-initialization of the array to the value > +which cannot represent a real numa node or valid error of status array > +could help to identify pages that have been migrated > .PP > .I flags > specify what types of pages to move. > @@ -164,9 +166,13 @@ returns zero. > .\" do the right thing? > On error, it returns \-1, and sets > .I errno > -to indicate the error. > +to indicate the error. If positive value is returned, it is the number of > +non-migrated pages. > .SH ERRORS > .TP > +.B Positive value > +The number of non-migrated pages if they were the result of non-fatal > +reasons (since version 4.17). > .B E2BIG > Too many pages to move. > Since Linux 2.6.29, > -- > 1.8.3.1 -- Michal Hocko SUSE Labs