From patchwork Mon Jul 11 08:49:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12913161 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 B2CFCCCA47B for ; Mon, 11 Jul 2022 08:50:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F1206B00B1; Mon, 11 Jul 2022 04:50:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 27A006B00B3; Mon, 11 Jul 2022 04:50:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F46E6B00B4; Mon, 11 Jul 2022 04:50:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F077D6B00B1 for ; Mon, 11 Jul 2022 04:50:18 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C31E2340D7 for ; Mon, 11 Jul 2022 08:50:18 +0000 (UTC) X-FDA: 79674197316.18.F3306EC Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf16.hostedemail.com (Postfix) with ESMTP id 390EC180056 for ; Mon, 11 Jul 2022 08:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657529419; x=1689065419; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pYmlZTWW8T052yrvDTxhlle8aydW1U/tmRbuqMhTmdg=; b=T4fIoUS7/kU8EYav+SODvJCWfsyGOeXy5NxFIBt0EbHXWYeqVbSWY2UW idKM6Q60EKEk9E98c/PozX2psdMlvgZRZtEwHl9km+MyyyhWF7/sxScpQ EAz8O60f3NT06xfQJYhT0pcjjGcOMDy9Xd+CV0fHFIQxlh2fhq7Wk9cIT YNRhtxvBPv/ibhLbdaXrBhojC50FjD/18kamgDcaKgsBONma+zLGUAGQq +JkTIN7jZOQ+tBj71mpRAslhbUevYh7wdsj6WblIM2AE6wYa9zLbilPew 2crPjrv73jcwTgCYkflPh5qpAjd2HIVT5Q+3MTg2Wu6LJC7LsnsPQzzIY A==; X-IronPort-AV: E=McAfee;i="6400,9594,10404"; a="346296616" X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="346296616" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:18 -0700 X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="652374188" Received: from yhuang6-mobl1.sh.intel.com ([10.238.5.168]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:16 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Zi Yan , Yang Shi Subject: [PATCH -V2 7/7] migrate_pages(): fix failure counting for retry Date: Mon, 11 Jul 2022 16:49:48 +0800 Message-Id: <20220711084948.274787-8-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220711084948.274787-1-ying.huang@intel.com> References: <20220711084948.274787-1-ying.huang@intel.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=T4fIoUS7; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf16.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657529418; 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=+WxijoM26Zyr9Tm/zCbdNSVlsPAIjKiv0YB4dMEFsi0=; b=F8wP5jbP+hESeyI3f+/40RJHVkFucCIYdgXhKgk1ugZhtsj5fbyWQe8kcdX/Rh3qhTaX+Y WgNJSrJqmMhP0jblL6U201RYHLAFY5bHnD1YjV0gsHcVspRbyLwvnDLTgW++DgbOQae+et prOiME8XdubNgdz7akylnxPvg4/P4iA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657529418; a=rsa-sha256; cv=none; b=o4HvvgxFhMWMMcNExtOPWRv0Sm77NJm53xVRJPY7sqifpVUwe/eDudcd2/+t1w4iVZ/dZX nUEXEY9FRXvHvXbzN0y722aYXdjlB5BM9Fez8w58V/ATsQ+V/t5cscCYLGYfOBEZNG/8nT r4QIUsCSm46aBHzPtjy6TiBrAQx+Tuk= Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=T4fIoUS7; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf16.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: gxatyyiy7tsioqgpwfad3hok9xwkduyt X-Rspamd-Queue-Id: 390EC180056 X-HE-Tag: 1657529418-23700 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") Reviewed-by: Baolin Wang Cc: Zi Yan Cc: Yang Shi Reviewed-by: Oscar Salvador --- mm/migrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 557708ce13a1..cee6fc5a2d31 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1345,6 +1345,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; @@ -1365,6 +1366,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) { /* @@ -1439,7 +1441,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 @@ -1455,6 +1457,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; @@ -1481,6 +1484,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