From patchwork Wed Aug 17 08:14:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12945633 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 E7F0AC32772 for ; Wed, 17 Aug 2022 08:14:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E91448D000A; Wed, 17 Aug 2022 04:14:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7D248D0001; Wed, 17 Aug 2022 04:14:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF6568D000A; Wed, 17 Aug 2022 04:14:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AB1118D0001 for ; Wed, 17 Aug 2022 04:14:39 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 848031A07B0 for ; Wed, 17 Aug 2022 08:14:39 +0000 (UTC) X-FDA: 79808373078.02.5E61752 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf24.hostedemail.com (Postfix) with ESMTP id A005B1801D5 for ; Wed, 17 Aug 2022 08:14:38 +0000 (UTC) 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="293710821" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="293710821" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660724079; 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=0CEPt2mvRCaJmjgKqzhFE6NL6/HNq1d55MwRyas7yzA=; b=itiVndt5j850BJ+OPaxS16MTTmVUytAPBLbynTrdcVPhy6+rE+WhH1ww+PqB8EcCA5Eqj0 MhLLT7KAzroK5iea+rDyv4QDP6l2/YqZEBdeD9WN9TMLfWBUYarSHh5Tbdh9DflaG7yfV4 5hZExxxTwgAhetsGR4aZ43wXcOy1ZlE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=JT61dFbc; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660724079; a=rsa-sha256; cv=none; b=084ZhLKEgTXxkwfAYlq1U2/BT82YEuVHoC1/t91AOEs7+IZ6UkJmF0DgYAxZGgr6KJ8B2H Vv22pRngbs+c+JE457uikXB+6TaFt2WYpzuTKWd6LxxwXbG/yCkPUtBFHzHEhr0hRnX4Uv QxuAWs5CH7iyQkMG2EH5k3uDNyJVhl0= Authentication-Results: imf24.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=JT61dFbc; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com X-Rspam-User: X-Stat-Signature: qzfcsamymkkmhysz3tb6mkqph9fm3gs1 X-Rspamd-Queue-Id: A005B1801D5 X-Rspamd-Server: rspam11 X-HE-Tag: 1660724078-460212 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 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