From patchwork Mon Jun 27 02:25:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12895974 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB142C43334 for ; Mon, 27 Jun 2022 02:25:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 515336B0071; Sun, 26 Jun 2022 22:25:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C5126B0072; Sun, 26 Jun 2022 22:25:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38DBB8E0001; Sun, 26 Jun 2022 22:25:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 29FD56B0071 for ; Sun, 26 Jun 2022 22:25:25 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 04E5760472 for ; Mon, 27 Jun 2022 02:25:24 +0000 (UTC) X-FDA: 79622424210.10.2A115AC Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf04.hostedemail.com (Postfix) with ESMTP id 5877540021 for ; Mon, 27 Jun 2022 02:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656296724; x=1687832724; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Talc3qs8+aIEJrvLvRNy14H65O5Ln3+oQKwcRjbNGPk=; b=N4yyM2DrGHByNfWJmGKTHPLxYDI+w5+DqGekn1jVuTAmxRVRdj5BT9rX VzV69P4j0A9GLCHSH/FMn6MQ4FDhjMM9JZ9MoEqJOqOvYTsD76orfUwec eS4ql4AAM+zbSQPlmDY2oUAEiIyktpUaF2RjZ6DUmKYJQg5rP3Bt9WpKj L29WEGMLPAvf3hVsqKMCuH2BGvZ3o40TBTik2dmSYzyfK7x6mVLm71pMp V+g0JmjZrLDyxo0hELcpVl4+qlSlfkIdFjC1ix7pqDuNrQ6TO8bWtbQVm dJp3IUZHDHCrSIx5M8pcB795y/9VLjEeuBT5T1DQwOpo0LyJ0LmN3YtQ1 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10390"; a="343022793" X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="343022793" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2022 19:25:22 -0700 X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="916513102" Received: from yhuang6-mobl1.sh.intel.com ([10.67.65.240]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2022 19:25:20 -0700 From: Huang Ying To: akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, shy828301@gmail.com, ziy@nvidia.com, Huang Ying Subject: [PATCH 7/7] migrate_pages(): fix failure counting for retry Date: Mon, 27 Jun 2022 10:25:15 +0800 Message-Id: <20220627022515.1067946-1-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624025309.1033400-1-ying.huang@intel.com> References: <20220624025309.1033400-1-ying.huang@intel.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656296724; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Rqp54ieyemFjUI9psMcIkUe1NwqeI0+qW8kLkgrSV4U=; b=TVgW3fJoZtwYYGQSDWmx1kka+mbxwSsljPmoWmzbHgaPJGngeC6c8XeOE/pGDh/JvurQ1a PsTLYya3fD1S+slHdNnnb4m9cTleiyOejYye6a32/SoVQDxp+2CJixeKQERqK7kRXCWudZ NkLPnuFyDz5Hidnf/2dQ0GWVQbbHxKg= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=N4yyM2Dr; spf=none (imf04.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656296724; a=rsa-sha256; cv=none; b=Lu76voXGP0fxnbJDkNYGTYYFrC6JmE4qypQavMpVoJgMOEfYvNcpn3cvkmrMYHdYwcEgtk Uj8RKXbl9uD6uOhNxLeHUyfAIEstWOSqlZG5vVxiqDFxV3nlMJTiK0nCP5WFK8qr0pqAsA 0ZJC7rTWqc2YD0MGZ4WuL96EBhq1Nok= Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=N4yyM2Dr; spf=none (imf04.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: a5nzztskj8xtmqtph3b77s6xohuzcqj5 X-Rspamd-Queue-Id: 5877540021 X-HE-Tag: 1656296724-641382 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Baolin Wang --- 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; 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