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,URIBL_BLOCKED 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 5F7B9C2D0DB for ; Wed, 29 Jan 2020 18:58:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3073920720 for ; Wed, 29 Jan 2020 18:58:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3073920720 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 B51AE6B0281; Wed, 29 Jan 2020 13:58:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B04146B0282; Wed, 29 Jan 2020 13:58:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A18B26B0283; Wed, 29 Jan 2020 13:58:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 8B4316B0281 for ; Wed, 29 Jan 2020 13:58:46 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 343B52C96 for ; Wed, 29 Jan 2020 18:58:46 +0000 (UTC) X-FDA: 76431583452.29.gate90_2f6926a46e023 X-HE-Tag: gate90_2f6926a46e023 X-Filterd-Recvd-Size: 5059 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Jan 2020 18:58:45 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id z3so771064wru.3 for ; Wed, 29 Jan 2020 10:58:45 -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=GsWVLKic92GtxCUorsUXtFluyqDSQVQyet+6x8x0QOA=; b=EhQSkgbE5dCnLkIBFBpAbqnyq7pwCJT12KxkEzfmOHdgDfHBW9POmawzj+oamNHMnb ZYIVFCAzRbYlt4y08lLvkrqUxx/3tB7ZX82bG2uM0JgwZmc29+hf95xpmhzDVjIuDKLb GfmW7J5EYR4Rg5ioiII7SLxhUHemeaPaVNRrDMReOWwTt236X79ZcBdgCqj3HXXEk4R2 YvZaks8onHHJuFUx2dp8FmbxXZNr/0eVbtzfS6GoVObb70zn4/BGh+azAaYm4PHQ9ESv 0c09JtE3TqzwgLKIw8hUbr+fPNVBQ1obMA5OJQk3q0NCen3Zfoh/ULm00EZa6rv8MOcI k4VA== X-Gm-Message-State: APjAAAW/9SJna+XRH3KkM9vgyphxKN9DxJMPsfIe+7/RKkSFAD+kwfCx sI8W39TzIJdV2upwKkmgk1g= X-Google-Smtp-Source: APXvYqzo5VG3GcA1V9l4HggoKbcu/wKCAaRVFi+3RNALt3YLKU4l8ohhyy9Lnsy20EWBElBuogjX2Q== X-Received: by 2002:a5d:458d:: with SMTP id p13mr265708wrq.314.1580324324634; Wed, 29 Jan 2020 10:58:44 -0800 (PST) Received: from localhost (ip-37-188-238-177.eurotel.cz. [37.188.238.177]) by smtp.gmail.com with ESMTPSA id d12sm3977076wrp.62.2020.01.29.10.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 10:58:43 -0800 (PST) Date: Wed, 29 Jan 2020 19:58:42 +0100 From: Michal Hocko To: Yang Shi Cc: mtk.manpages@gmail.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: [PATCH] move_pages.2: Returning positive value is a new error case Message-ID: <20200129185842.GP24244@dhcp22.suse.cz> References: <1580322632-93332-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: <1580322632-93332-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 Thu 30-01-20 02:30:32, 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. Thanks a lot! Looks good to me. I would just add a note that it is generally recommended to pre-initialize status array by -1 to have a reliable way to check which pages have been migrated. The man page says "The array contains valid values only if move_pages() did not return an error." I would just add. "Pre initialization of the array to -1 or similar value which cannot represent a real numa node could help to identify pages that have been migrated". > Cc: Michal Hocko > Cc: Michael Kerrisk > Signed-off-by: Yang Shi Acked-by: Michal Hocko > --- > man2/move_pages.2 | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/man2/move_pages.2 b/man2/move_pages.2 > index 1bf1053..c6cf3f8 100644 > --- a/man2/move_pages.2 > +++ b/man2/move_pages.2 > @@ -164,9 +164,13 @@ returns zero. > .\" do the right thing? > On error, it returns \-1, and sets > .I errno > -to indicate the error. > +to indicate the error. Or positive value to report the number of > +non-migrated pages. > .SH ERRORS > .TP > +.B Positive value > +The number of non-migrated pages if they were result of a 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