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 65888C33CAA for ; Thu, 23 Jan 2020 08:55:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3018124686 for ; Thu, 23 Jan 2020 08:55:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3018124686 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 DAFB46B0003; Thu, 23 Jan 2020 03:55:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D60716B0005; Thu, 23 Jan 2020 03:55:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4EED6B0006; Thu, 23 Jan 2020 03:55:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id ABCB36B0003 for ; Thu, 23 Jan 2020 03:55:29 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 5C14E582C for ; Thu, 23 Jan 2020 08:55:29 +0000 (UTC) X-FDA: 76408290378.08.bit65_6a14ea09b6f0a X-HE-Tag: bit65_6a14ea09b6f0a X-Filterd-Recvd-Size: 5047 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Thu, 23 Jan 2020 08:55:28 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id z7so2082153wrl.13 for ; Thu, 23 Jan 2020 00:55:28 -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=QN0GytJlQ8IoR8mCnHpKkK8Cwd+3Z4QrENywxxSV18c=; b=J6HUq2Nc7uQNTfwWj2O2lFF6gAxICBFPznUTjrrDqUH9u8msCNvznXZ0H+YXPbuQBE av//A2ScUn6/j3eNhdS/mx8fZil+I4+TWsspwrZpSWEXiZpgveHVEdVLO1gqgzmzaElU X+1wo8b00GSdv1a//F7e1Rxu/yb8w6WtK83xYQUeKY72Q7KvA1G/4n6qDOiksNutzJO9 lOGZOLXGe7rJJLaCFICQUP/dPRHlU2fXmHB2uJJm0evjOaycvG6m5cFhA8HKdBkeH2MC gl5QQZbS8qk6C3RgT0SgUjhXeLcjQ4tgtaftqeQf/51Bn433G5OVMTX8fpGtjhY1rucz GWyw== X-Gm-Message-State: APjAAAVJMUyoyEpQYtjYsOgbiBQnfqAMk4GiHipPdgFBV9vsVpniq3XT cu+QhCqPtXRDN6t4U23Jicg= X-Google-Smtp-Source: APXvYqxE4kCL96Yx0I5czZuD0dgQc16eDRuFzdGJRJuBkF2YjgYdk0l++2io4mKgbgJpWP9ttZvgZw== X-Received: by 2002:adf:dfc1:: with SMTP id q1mr16374200wrn.155.1579769727653; Thu, 23 Jan 2020 00:55:27 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id f12sm1821295wmf.28.2020.01.23.00.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2020 00:55:26 -0800 (PST) Date: Thu, 23 Jan 2020 09:55:26 +0100 From: Michal Hocko To: Wei Yang Cc: Yang Shi , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [v2 PATCH] mm: move_pages: report the number of non-attempted pages Message-ID: <20200123085526.GH29276@dhcp22.suse.cz> References: <1579736331-85494-1-git-send-email-yang.shi@linux.alibaba.com> <20200123032736.GA22196@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200123032736.GA22196@richard> 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 23-01-20 11:27:36, Wei Yang wrote: > On Thu, Jan 23, 2020 at 07:38:51AM +0800, Yang Shi wrote: > >Since commit a49bd4d71637 ("mm, numa: rework do_pages_move"), > >the semantic of move_pages() was changed to return the number of > >non-migrated pages (failed to migration) and the call would be aborted > >immediately if migrate_pages() returns positive value. But it didn't > >report the number of pages that we even haven't attempted to migrate. > >So, fix it by including non-attempted pages in the return value. > > > > First, we want to change the semantic of move_pages(2). The return value > indicates the number of pages we didn't managed to migrate? > > Second, the return value from migrate_pages() doesn't mean the number of pages > we failed to migrate. For example, one -ENOMEM is returned on the first page, > migrate_pages() would return 1. But actually, no page successfully migrated. ENOMEM is considered a permanent failure and as such it is returned by migrate pages (see goto out). > Third, even the migrate_pages() return the exact non-migrate page, we are not > sure those non-migrated pages are at the tail of the list. Because in the last > case in migrate_pages(), it just remove the page from list. It could be a page > in the middle of the list. Then, in userspace, how the return value be > leveraged to determine the valid status? Any page in the list could be the > victim. Yes, I was wrong when stating that the caller would know better which status to check. I misremembered the original patch as it was quite some time ago. While storing the error code would be possible after some massaging of migrate_pages is this really something we deeply care about. The caller can achieve the same by initializing the status array to a non-node number - e.g. -1 - and check based on that. This system call has quite a complex semantic and I am not 100% sure what is the right thing to do here. Maybe we do want to continue and try to migrate as much as possible on non-fatal migration failures and accumulate the number of failed pages while doing so. The main problem is that we can have an academic discussion but the primary question is what do actual users want. A lack of real bug reports suggests that nobody has actually noticed this. So I would rather keep returning the correct number of non-migrated pages. Why? Because new users could have started depending on it. It is not all that unlikely that the current implementation would just work for them because they are migrating a set of pages on to the same node so the batch would be a single list throughout the whole given page set. -- Michal Hocko SUSE Labs