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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 974B8C43334 for ; Fri, 24 Jun 2022 09:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbiFXJpw (ORCPT ); Fri, 24 Jun 2022 05:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiFXJpu (ORCPT ); Fri, 24 Jun 2022 05:45:50 -0400 Received: from out199-9.us.a.mail.aliyun.com (out199-9.us.a.mail.aliyun.com [47.90.199.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F2C379452 for ; Fri, 24 Jun 2022 02:45:48 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R311e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VHGe-V2_1656063944; Received: from 30.97.49.29(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VHGe-V2_1656063944) by smtp.aliyun-inc.com; Fri, 24 Jun 2022 17:45:44 +0800 Message-ID: Date: Fri, 24 Jun 2022 17:45:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 4/7] migrate_pages(): fix failure counting for THP subpages retrying To: Huang Ying , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zi Yan , Yang Shi References: <20220624025309.1033400-1-ying.huang@intel.com> <20220624025309.1033400-5-ying.huang@intel.com> From: Baolin Wang In-Reply-To: <20220624025309.1033400-5-ying.huang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/24/2022 10:53 AM, Huang Ying wrote: > If THP is failed to be migrated for -ENOSYS and -ENOMEM, the THP will > be split into thp_split_pages, and after other pages are migrated, > pages in thp_split_pages will be migrated with no_subpage_counting == > true, because its failure have been counted already. If some pages in > thp_split_pages are retried during migration, we should not count > their failure if no_subpage_counting == true too. This is done this > patch to fix the failure counting for THP subpages retrying. Good catch. Totally agree with you. It seems we can move the condition into -EAGAIN case like other cases did? diff --git a/mm/migrate.c b/mm/migrate.c index 1ece23d80bc4..491c2d07402b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1463,7 +1463,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, case -EAGAIN: if (is_thp) thp_retry++; - else + else if (!no_subpage_counting) retry++; break; Anyway this patch looks good to me. Reviewed-by: Baolin Wang > > Signed-off-by: "Huang, Ying" > Fixes: 5984fabb6e82 ("mm: move_pages: report the number of non-attempted pages") > Cc: Baolin Wang > Cc: Zi Yan > Cc: Yang Shi > --- > mm/migrate.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 542533e4e3cf..61dab3025a1d 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1477,7 +1477,8 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > } > } > } > - nr_failed += retry; > + if (!no_subpage_counting) > + nr_failed += retry; > nr_thp_failed += thp_retry; > /* > * Try to migrate subpages of fail-to-migrate THPs, no nr_failed