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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 7AAF8C2D0DB for ; Wed, 29 Jan 2020 19:11:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4B275205F4 for ; Wed, 29 Jan 2020 19:11:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B275205F4 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 D6BF16B0003; Wed, 29 Jan 2020 14:11:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF5E76B028E; Wed, 29 Jan 2020 14:11:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBE0E6B028F; Wed, 29 Jan 2020 14:11:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id A22F16B0003 for ; Wed, 29 Jan 2020 14:11:09 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 55C13181AC9B6 for ; Wed, 29 Jan 2020 19:11:09 +0000 (UTC) X-FDA: 76431614658.19.run10_a08829b0473e X-HE-Tag: run10_a08829b0473e X-Filterd-Recvd-Size: 4640 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Jan 2020 19:11:08 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id m16so748014wrx.11 for ; Wed, 29 Jan 2020 11:11:08 -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=SIceE1wI3YF4e1poItQ4Q7P/TSmlkSI5vcj8MyFkpaU=; b=ADDa813D1xkFle7cRuDwye6So3D5/nDV/icjnbiAZf+IVrShGGqgg9rzVqSIc5JBQe Jw+YOloxITI7w0fI/dxhjnVczHx4HYR4k1venQYiCloysuIlI2eG8A2yhy4Lnt6JZDnN dbiHEjrsIuT6PI8MkmDaFJSn9L6tZrOozbbTmEK6JyKVUYD4htiLLL6qZ1FH83r4YIZK HfQwlZKAhQ5ZixVstebWHrV8BUAPn5NjqVnfZsc2f/xNb6xQJtcEEmbq5enDIVOlkGyQ Qks6BVTIA7hob+jYaT1UpmkHUj8g3eAyQNSq4dcWzHtXyZJWR5YJbUs2Lz/AyYZhk5sq UBfg== X-Gm-Message-State: APjAAAUKc6ElY6im55W+jBAoMqdvvrAawpp+p033qZHmLdDEc/9+Trd4 xhI0px6BR7KYnuyWc+05CGM= X-Google-Smtp-Source: APXvYqy97iIBhkWlXIbBgOCQgTV5ITJ1SJOSPHmwFOOc/feGNmfKEj40R8RLUM6K2oZlWyuUrXs57Q== X-Received: by 2002:adf:f411:: with SMTP id g17mr291305wro.89.1580325067778; Wed, 29 Jan 2020 11:11:07 -0800 (PST) Received: from localhost (ip-37-188-238-177.eurotel.cz. [37.188.238.177]) by smtp.gmail.com with ESMTPSA id x17sm3886869wrt.74.2020.01.29.11.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 11:11:07 -0800 (PST) Date: Wed, 29 Jan 2020 20:11:05 +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: <20200129191105.GQ24244@dhcp22.suse.cz> References: <1580322632-93332-1-git-send-email-yang.shi@linux.alibaba.com> <20200129185842.GP24244@dhcp22.suse.cz> <0db6a002-d067-8acd-65ee-8c87a32ff769@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0db6a002-d067-8acd-65ee-8c87a32ff769@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 Wed 29-01-20 11:05:11, Yang Shi wrote: > > > On 1/29/20 10:58 AM, Michal Hocko wrote: > > 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". > > Sure. Adding this note right after the explanation of positive value error > seems fine? I would just follow up on the existing note about valid values. -- Michal Hocko SUSE Labs