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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0313C3A59D for ; Mon, 24 Oct 2022 06:03:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E9B58E0002; Mon, 24 Oct 2022 02:03:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09AB88E0001; Mon, 24 Oct 2022 02:03:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECC0C8E0002; Mon, 24 Oct 2022 02:03:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DDD4E8E0001 for ; Mon, 24 Oct 2022 02:03:11 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6F0DE80777 for ; Mon, 24 Oct 2022 06:03:11 +0000 (UTC) X-FDA: 80054800182.21.246AFD9 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by imf10.hostedemail.com (Postfix) with ESMTP id 7D9C9C0031 for ; Mon, 24 Oct 2022 06:03:09 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0VStC9yI_1666591383; Received: from 30.97.48.50(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VStC9yI_1666591383) by smtp.aliyun-inc.com; Mon, 24 Oct 2022 14:03:04 +0800 Message-ID: Date: Mon, 24 Oct 2022 14:03:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v2 1/2] mm: migrate: Fix return value if all subpages of THPs are migrated successfully To: "Huang, Ying" , Yang Shi , Andrew Morton Cc: david@redhat.com, ziy@nvidia.com, apopple@nvidia.com, jingshan@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20221021114149.eadf6fafdd0b2c2409a46389@linux-foundation.org> <871qqym1bt.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Baolin Wang In-Reply-To: <871qqym1bt.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666591391; a=rsa-sha256; cv=none; b=XXP+mhqUKhx0zfG9aBJ/WRsK+OMNR1oFKV0HLdTFoVXBk6Si1SN5vDS6NYjb/kSmTbWF4x F/FPYCwbewJCZfn4gTxEeaFxROVMzxNRYqJWolge86pWc0IDEh4ttUnGL3T95ym5T9yKef q2iglGx+qPOohQD4TyuPl6bq9djl5bY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf10.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.57 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666591391; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hDWxCNuqGNh5RLZY5j25DLZScxVtJ2fSLTTX7C+aYCc=; b=KdkzEBbwQOtGHChxVl6ryLyONZM3xCftMPKg16l3UPw9IL8HJEdcHaeaur2f/xuch4porD Ss7+j7Wr+8Wy2rPt/C4GQiZoCssh/Q1gPMQ2jdnXNypxZ89lLlD32rrsrU7W4gO7GiRxlk qiG7kStsJg3EQq63Ro2uhDS96Luwmv4= X-Stat-Signature: sjnmf3nu4hht5fdasr486yyt3xg7bc3e X-Rspamd-Queue-Id: 7D9C9C0031 Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf10.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.57 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1666591389-242768 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 10/24/2022 9:56 AM, Huang, Ying wrote: > Yang Shi writes: > >> On Fri, Oct 21, 2022 at 11:41 AM Andrew Morton >> wrote: >>> >>> On Fri, 21 Oct 2022 18:16:23 +0800 Baolin Wang wrote: >>> >>>> When THP migration, if THPs are split and all subpages are migrated successfully >>>> , the migrate_pages() will still return the number of THP that were not migrated. >>>> That will confuse the callers of migrate_pages(), for example, which will make >>>> the longterm pinning failed though all pages are migrated successfully. >>>> >>>> Thus we should return 0 to indicate all pages are migrated in this case. >>>> >>> >>> This had me puzzled for a while. I think this wording is clearer? >>> >>> : During THP migration, if THPs are not migrated but they are split and all >>> : subpages are migrated successfully, migrate_pages() will still return the >>> : number of THP pages that were not migrated. This will confuse the callers >>> : of migrate_pages(). For example, the longterm pinning will failed though >>> : all pages are migrated successfully. >>> : >>> : Thus we should return 0 to indicate that all pages are migrated in this >>> : case. >>> >>> This is a fairly longstanding problem? No Fixes: we can identify? >> >> It doesn't seem like a long standing issue. It seems like commit >> b5bade978e9b ("mm: migrate: fix the return value of migrate_pages()") >> fixed one problem, but introduced this new one IIUC. >> >> Before this commit, the code did: >> >> nr_failed += retry + thp_retry; >> rc = nr_failed; >> >> But retry and thp_retry were actually reset for each retry until the >> last one. So as long as there is no permanent migration failure and >> THP split failure, nr_failed should be 0 IIUC. TBH the code is a >> little bit hard to follow, please correct me if I'm wrong. > > I think that you are correct. We can added > > Fixes: b5bade978e9b ("mm: migrate: fix the return value of migrate_pages()") I think so too. Thanks Yang and Ying for pointing it out. > >>> Did you consider the desirability of a -stable backport? > > I think this can be backport to -stable. Agree. Andrew, could you help to add the Fixes tag and cc -stable? Thanks.