Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4537767rwb; Wed, 17 Aug 2022 01:31:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6M3+2ZP45L/ArNuLNei82WzrLWRvq300BLnXLbx4Kvr9uxpkSA0WFKA8KiXbyn4om4ciya X-Received: by 2002:a17:906:8a6d:b0:730:9cd5:6688 with SMTP id hy13-20020a1709068a6d00b007309cd56688mr15964687ejc.158.1660725071100; Wed, 17 Aug 2022 01:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660725071; cv=none; d=google.com; s=arc-20160816; b=yVhORiOFHbb2LQuRskUgqm6IW0fyxl18ZgORLf91M7HHyek94Rna0Hw2d2qpMYLRnl q/twVTjZtiCIAuRZqB89ZGsm7Lx2Y/DEJ2ehq+g9Gl+yiJrwVRVuVF7/dzWcxN/BTYvZ SOfAbfAF+QiQge6z5Bq2c95y6D0ppNZU65muJ1D7S9FKuxe38fl0y10tRiRKMapnRfb6 I/39xjOSzQGCCA1nNdcEIcERuFjn1hr00dLsR9M7i+sEtFXJg6MDcDyiAU+ZAaSUy3pI rgN4/1rHSFKJOGPyawVSfz73Q9hO9YYU9FdeVJQGyQW9dz1RtY0uf1JIHQe9Nq9qJp+Z aMZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0CEPt2mvRCaJmjgKqzhFE6NL6/HNq1d55MwRyas7yzA=; b=Xx74IJhom0tZQQwO7UlrT0/5fWoh91IGnZaeMlv0d8EsubK739Vp4RJ9+QlDtURWat fGJ+GMR2d9UBwupmOHCkIbfMjHJ6wtuD2hP1YPneCBHwW4KyKJnW09kCGXa+nNn64na3 EmdDoGMqRPrOiiwzYScko6U/LlVv5n1MiFcuv9QDylKr+l35rBEUKaigUwgIDwUGE1le vhEltDmsCSBkUmCTx8fJm+9rouJ8ZnTxiIbNoIbqo7J48jMwtAyNsLb9C+nJGM00YRSZ RzaVavtvpztsNJhoLD2MmwBUWRnvAKzuV7BokBMXxE6eu522p6VFzq0uMqkk5llAei25 CW/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JT61dFbc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb5-20020a0564020d0500b0043ab664c9e7si14010972edb.282.2022.08.17.01.30.44; Wed, 17 Aug 2022 01:31:11 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=JT61dFbc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234371AbiHQIQH (ORCPT + 99 others); Wed, 17 Aug 2022 04:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234658AbiHQIOx (ORCPT ); Wed, 17 Aug 2022 04:14:53 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472426DFB5 for ; Wed, 17 Aug 2022 01:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660724078; x=1692260078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3FCN6Jt3Sb1+/b+KmRNGXeRqM8oFvsuaOTMG3DWs02g=; b=JT61dFbc6R4+8Lr+EZto86WHHZh2sQqrgYz+NjgLTfmJ6Evi4QvDtcMu atCFXNEd2EK7fF/M+b2ieqE0evvhCHeAS6USmSIYaD/Mm3ZEfgvImHxFJ Za6l3bxlVuoPRzYlKO4cWVfOshmNJlFO6lbLhpss2Encul3sxe3oVsTyL 8hW2C42GpbZP1boI5XuFqEh08yDX8MQy+2Euq0zg+DpbeJoZUuj2A36Hc oTfTgcTcthUaBL1aUdsr8RpywffAOxNv8RWPuHUTkqYb0ss0m8O+yUEDF y5O5Qgi97g14MW2KsYWRjtDNcWKuQmYrQVU1Ivsk7UooH6I51YwMg7gO+ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="293228852" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="293228852" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 01:14:37 -0700 X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="583668141" Received: from yhuang6-mobl1.sh.intel.com ([10.238.6.172]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 01:14:34 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Oscar Salvador , Zi Yan , Yang Shi Subject: [PATCH -V3 7/8] migrate_pages(): fix failure counting for retry Date: Wed, 17 Aug 2022 16:14:07 +0800 Message-Id: <20220817081408.513338-8-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220817081408.513338-1-ying.huang@intel.com> References: <20220817081408.513338-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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") Reviewed-by: Baolin Wang Reviewed-by: Oscar Salvador Cc: Zi Yan Cc: Yang Shi --- mm/migrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 81daa4dd3bb6..55fbf9669431 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1413,6 +1413,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; @@ -1433,6 +1434,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) { /* @@ -1506,7 +1508,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, nr_failed++; } - nr_failed_pages += nr_subpages; + nr_failed_pages += nr_subpages + nr_retry_pages; /* * There might be some subpages of fail-to-migrate THPs * left in thp_split_pages list. Move them back to migration @@ -1522,6 +1524,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, thp_retry++; else retry++; + nr_retry_pages += nr_subpages; break; case MIGRATEPAGE_SUCCESS: nr_succeeded += nr_subpages; @@ -1548,6 +1551,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 -- 2.30.2