Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp264018rdb; Thu, 19 Oct 2023 04:04:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW4lqh7YLP2tOvSp5DFiiqhO7880MPz33Ts+COeLwlAcq31I7wVuHVsi9Yk/A45agZSzFO X-Received: by 2002:aa7:88c9:0:b0:693:3c11:4293 with SMTP id k9-20020aa788c9000000b006933c114293mr1748317pff.14.1697713452929; Thu, 19 Oct 2023 04:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697713452; cv=none; d=google.com; s=arc-20160816; b=cInQHTd6MI2JTQQRLSQtRQ1HP1PgisFokbpm6V77BVNzb889dwT2Q/NluWVG9XvJ5U 3bgg+9/ntwx62Ko8iUXYQKt4MA+crcRyqkMdAc9ElswYnRAqlMtdGqGKlgKph4Rq7Kt3 rVqocOqgoNSZPTUJO51UNDK4fcWqqjDF4II1FRy+H9AHo1MlttjzWiBEU4G7fse+Qbjg oFrfsKsnonFw3xx7Eg64GCU9h1+w1taIzKrwF2sRG/aR6unAjya5jtHSMi9XNYGjBOQ+ qgQlgT+mCKu1TyvPHdjfE/HfCBVgDdPj9vo6CFKycZYSKPMNZV4cUiTbtdf3FK/yxQTZ iTPA== 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=99BNKAzCnvDxO+PBdy8dL3hNfpWpoAwTugwuoAs+u/s=; fh=THceKZap8mo6C+5us1+A1/HUF2DS1ITIX7hwW+szKd8=; b=LxkiRIVok1K/sMKMLG90dzSPfv4IXHT0MytqBGKciVKskE8akVlZG5L3a1Sw0WXbf1 eBehMSYTsfc9CoPA5TqpTIW9Ktvj3gjoevW/5EmBHJ5MVMl64ZP28xqDK1t5NK7KkF47 jqqTukf2gskt87dVS1QlHrygGz+F+Hb2jF35hxz/P0f7baZZKyn/ZE0Gn6gx/GPJ2un3 aM3xJpekzZxhpcllkSDxPBKXBy33DEzmgvhMr92iKlwX9bk89+tdk6DWkeydA49EFZoo tgM5erMbh63FH/HU6j03IG9MRHub8iuvQRMySj3HYvGhVW38r/QmycuDrnfTRwxD2JK1 l1QA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n2-20020a632702000000b00578c9144910si4486416pgn.410.2023.10.19.04.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 04:04:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3DAF0822CBC1; Thu, 19 Oct 2023 04:04:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345224AbjJSLEI (ORCPT + 99 others); Thu, 19 Oct 2023 07:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233051AbjJSLEG (ORCPT ); Thu, 19 Oct 2023 07:04:06 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89452124 for ; Thu, 19 Oct 2023 04:04:04 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VuTwO7v_1697713439; Received: from 30.97.48.56(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VuTwO7v_1697713439) by smtp.aliyun-inc.com; Thu, 19 Oct 2023 19:04:00 +0800 Message-ID: Date: Thu, 19 Oct 2023 19:04:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v3 1/2] mm/migrate: correct nr_failed in migrate_pages_sync() To: Zi Yan , Huang Ying , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand References: <20231017163129.2025214-1-zi.yan@sent.com> From: Baolin Wang In-Reply-To: <20231017163129.2025214-1-zi.yan@sent.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 04:04:11 -0700 (PDT) On 10/18/2023 12:31 AM, Zi Yan wrote: > From: Zi Yan > > nr_failed was missing the large folio splits from migrate_pages_batch() > and can cause a mismatch between migrate_pages() return value and the > number of not migrated pages, i.e., when the return value of > migrate_pages() is 0, there are still pages left in the from page list. > It will happen when a non-PMD THP large folio fails to migrate due to > -ENOMEM and is split successfully but not all the split pages are not > migrated, migrate_pages_batch() would return non-zero, but > astats.nr_thp_split = 0. nr_failed would be 0 and returned to the caller > of migrate_pages(), but the not migrated pages are left in the from page > list without being added back to LRU lists. > > Fix it by adding a new nr_split counter for large folio splits and adding > it to nr_failed in migrate_page_sync() after migrate_pages_batch() is > done. > > Fixes: 2ef7dbb26990 ("migrate_pages: try migrate in batch asynchronously firstly") > Signed-off-by: Zi Yan > Cc: Baolin Wang > Cc: David Hildenbrand > Cc: Huang Ying > Cc: Matthew Wilcox > --- LGTM. Feel free to add: Reviewed-by: Baolin Wang