Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3535001ybv; Mon, 10 Feb 2020 01:37:07 -0800 (PST) X-Google-Smtp-Source: APXvYqygfyOSX8Nv3sdXwJMkrGu6vNHfTFxnNqNdHOo5wNHQc5ZC5WLlQaDd9iP+A36MarzJZFCn X-Received: by 2002:aca:2118:: with SMTP id 24mr297969oiz.28.1581327427654; Mon, 10 Feb 2020 01:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581327427; cv=none; d=google.com; s=arc-20160816; b=Ak/TDh0Z6+g9UyKbNW0yhheQ37+s2pV5av91+MluwciAIt502xb3vwlkBK4HsXD7iv fEArA6DxZAUxgltLA/sUgfqBAWu5zHJ6qhgvkGgencbnFOsG6vHsSL8N5tzieyvaWSHF iwNSjDL1ZMT0w/FCzE76VOkFxH3fypS69RB6RVhkM3IkAMyQRpEb/ImXXkaRo6zTITMt etZ340esQ9t8TYK3hMZ9CVE4EX3JPxZJ97/M1vMon2WvoXEGHkyMJT9sESUw4JqS7OES k6rlAxQh85C9hOuH042sZpDj8dWImg3MXMeH8eckapF0QD/kcW0FUR89JwtvM9/bKxHZ 0gfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=gSMBBgHYZjC32JQ2hZUg1g8OrBnMTL0dXFRwmZKq0Uo=; b=iVllPeWi8PylpLmmHCwOL4lJ9ZXAvLSdi/CKFl5zqqlJMjCIhphS4gHMnjJ1mdJNvz pR4iQ8HQIKE1Qu0faHuQw1DZByLGCMiTK8+Q2JSS/SV/BHjGctxsT2N41/S4w9TcPQ5o 8HKUjZSl6tosMYSdh6XLZP9cdl4D3jr5i8TnfP90Eqhec48TsGi9Y6KQy984gk9gbUVc 1eZfoqPw4eOqw99HJU3SSRBifO4QCsk9D+3KTkTG8GQ/vYQSpRMMJ3CUe4j6FL4WzXSc PGhEjF7u0jaM0sLtXst1Ji4lO4i7pKPE2UE7ENGyOP/sRrfqnGDvptYUgYPRgk6vUO/F cv6A== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w142si7975096oia.132.2020.02.10.01.36.56; Mon, 10 Feb 2020 01:37:07 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727496AbgBJJgj (ORCPT + 99 others); Mon, 10 Feb 2020 04:36:39 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34143 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbgBJJgi (ORCPT ); Mon, 10 Feb 2020 04:36:38 -0500 Received: by mail-wr1-f67.google.com with SMTP id t2so6721533wrr.1; 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=Ya3l91ORMFVImxnlDGLWzCOl32yTNviXxrBwLvjwvk/VEOdalVqn0WY+rLtTFXUL1+ 1eNDB9kGQysir+uxgCG/cb0ACg9DRYnejCvYj8jvJoinCpb0uIJ1W6230dAfhTHWNmA4 OK1CtipAXj3j7qvZoDH8SHAjTT1I4a6vRU68U+yB34qPlYSjEK1ymH1y5S3AFYZ4jvXE iy+2MBkfmjk5mYsZf3vdZx4zkZOWp6KKW/EFVf7rWCDSOakCoCOEURqEFKHWI4PkLn1S F8bYKMVyfnnaRvPx9ZZc/L6qmhcxi+pd32mNm66ItCratUV8gPJrxpnhFYwDT0t+6B0w NQWQ== X-Gm-Message-State: APjAAAXS3Kc7x+l0z8VOSGJRv9BZ3gt0xJdo0Rqfrm1/h2bzhTWu189N YKj6+LCaSYZCYa+II0jaWkE= 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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