Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6341949rwi; Sun, 23 Oct 2022 23:14:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HmpWfUTIRRa00zypPehmv4zlJIy3diktgyjqSkF4jNlijlyNkxdXf443zhJHecvrRXY1P X-Received: by 2002:a05:6402:e9b:b0:454:351c:c222 with SMTP id h27-20020a0564020e9b00b00454351cc222mr29540788eda.216.1666592098653; Sun, 23 Oct 2022 23:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666592098; cv=none; d=google.com; s=arc-20160816; b=yE+Tuuk70CXMddapMP62UlNfbEgUugk5Dk7x5wxv/LRUluHEVCHiHLc+UtdNurunsO FhQS1WmYBFf/+tURFICDrD+EUhzhhF7/Q0m0xxhHjP7A+ZH6a8ijhmhEqbtArZvjT2ax W11MFU2ftG2G0ajUm2tmphtZLE1QKNdJ3sXM5RPL1xATsPAhaBrJYS36OL2BdTYiI4t/ LDhA06stzd2YFYo4SY9fFxDfoRvgC956tO2MAB2Wnwd6C2oaMb34BzJZkWX8N6Y/Jq8I VuhSMX3gT9eYtrzZexOmmUb3MqrB17//9DhNeXNYLoXxBxswN+a+dVkc2HHJDa424Esa w8PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=hDWxCNuqGNh5RLZY5j25DLZScxVtJ2fSLTTX7C+aYCc=; b=w0zemBH6T/POBCAfarR8Ohy+o9IGB9UD6pJJJpDN002cR8awCTDRH4iwHC/DzOl6VF ofSRcHl4of+6RsvM4AWIjvmWOkTC1rX4QmhpBS4bp93AOlSNJQeiwTb0w58d3x4P6hpE R/epstIUSHEUhjj/vOngYfO5apuyuG8np9uUmZdCmGlAw+ffrcquRbFtY9CUoK+d8QgW py+X9KaW1mUPQYCyrSFuRTYrGtmZjTng3JPnn57hdyYWZSqaeHRl1+RKej3qWHUwDXdD xksUeEmWGa69poKT6u1+vl+Z1QSEy3a1jtc70fH2ksCwIYU2QHW76K9WExVvLV/qVgO3 hXGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk16-20020a1709077f9000b0078e19037659si21771815ejc.792.2022.10.23.23.14.33; Sun, 23 Oct 2022 23:14:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230180AbiJXGDL (ORCPT + 99 others); Mon, 24 Oct 2022 02:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiJXGDJ (ORCPT ); Mon, 24 Oct 2022 02:03:09 -0400 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E36D152DD5 for ; Sun, 23 Oct 2022 23:03:07 -0700 (PDT) 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 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.