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 AE759C433EF for ; Mon, 27 Jun 2022 04:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231869AbiF0E3b (ORCPT ); Mon, 27 Jun 2022 00:29:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229985AbiF0E33 (ORCPT ); Mon, 27 Jun 2022 00:29:29 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0218C48 for ; Sun, 26 Jun 2022 21:29:27 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VHRfB.M_1656304164; Received: from 30.32.122.103(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VHRfB.M_1656304164) by smtp.aliyun-inc.com; Mon, 27 Jun 2022 12:29:25 +0800 Message-ID: <5b40e07d-7ed3-7eba-ea71-52e5a06c1ec8@linux.alibaba.com> Date: Mon, 27 Jun 2022 12:29:28 +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 7/7] migrate_pages(): fix failure counting for retry To: Huang Ying , akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, shy828301@gmail.com, ziy@nvidia.com References: <20220624025309.1033400-1-ying.huang@intel.com> <20220627022515.1067946-1-ying.huang@intel.com> From: Baolin Wang In-Reply-To: <20220627022515.1067946-1-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/27/2022 10:25 AM, Huang Ying wrote: > After 10 retries, we will give up and the remaining pages will be > counted as failure in nr_failed and nr_thp_failed. We should count > the failure in nr_failed_pages too. This is done in this patch. > > 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 | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 70a0e1f34c03..e42bd409d3aa 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1344,6 +1344,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > int thp_retry = 1; > int nr_failed = 0; > int nr_failed_pages = 0; > + int nr_retry_pages = 0; > int nr_succeeded = 0; > int nr_thp_succeeded = 0; > int nr_thp_failed = 0; > @@ -1364,6 +1365,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > for (pass = 0; pass < 10 && (retry || thp_retry); pass++) { > retry = 0; > thp_retry = 0; > + nr_retry_pages = 0; > > list_for_each_entry_safe(page, page2, from, lru) { > /* > @@ -1449,12 +1451,14 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > nr_thp_failed += thp_retry; > if (!no_subpage_counting) > nr_failed += retry; > + nr_failed_pages += nr_retry_pages; Can you move this a little forward to update 'nr_failed_pages' in one place, which seems more readable? nr_failed_pages += nr_subpages + nr_retry_pages; Otherwise, Reviewed-by: Baolin Wang > goto out; > case -EAGAIN: > if (is_thp) > thp_retry++; > else > retry++; > + nr_retry_pages += nr_subpages; > break; > case MIGRATEPAGE_SUCCESS: > nr_succeeded += nr_subpages; > @@ -1481,6 +1485,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > if (!no_subpage_counting) > nr_failed += retry; > nr_thp_failed += thp_retry; > + nr_failed_pages += nr_retry_pages; > /* > * Try to migrate subpages of fail-to-migrate THPs, no nr_failed > * counting in this round, since all subpages of a THP is counted