From patchwork Wed Aug 17 08:14:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12945634 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 93FAEC25B08 for ; Wed, 17 Aug 2022 08:14:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B6348D000B; Wed, 17 Aug 2022 04:14:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E5908D0001; Wed, 17 Aug 2022 04:14:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00F398D000B; Wed, 17 Aug 2022 04:14:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E8B658D0001 for ; Wed, 17 Aug 2022 04:14:41 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CEEDEAAC37 for ; Wed, 17 Aug 2022 08:14:41 +0000 (UTC) X-FDA: 79808373162.27.5F7FE90 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf13.hostedemail.com (Postfix) with ESMTP id 2C46A201C9 for ; Wed, 17 Aug 2022 08:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660724081; x=1692260081; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CfWZdev3ddt5aOgW4WxIwyKcDYIQwXT1f+c+rDGkzjw=; b=T+C0sOZFP/Byu50d4FjifGGJCKSti2mOq7zZ4IA6suFdlX1ulqucx1KV rG4UHZW3IURhvyFjEQA9s7dhy5dt22ZzS4zCgV7VQG+BVh1T8h4OpU5yu Jn41IlVqGAQdglBgEg9O9YaXmcV3u8+ywmFKFb33vXeRXLWc8uj+U38DT 6aqDIch5Gk6tEytG9xA1UKSswTzz5aaMc8K3L6o+jtC4ckHALMTcTA6I/ 39dAlfujugPw0LKVUVU2t9OK/fkxd4pyr1ZvNmbF+IwOxoFKuK3D4hwDz 46GamjMOuYrIMx72Ltje8Lc1z+7MdWAnz0ZhyAhCnpbl3lCR+HO7N7WFO g==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="293710843" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="293710843" 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:39 -0700 X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="583668162" 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:37 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baolin Wang , "Huang, Ying" , Oscar Salvador , Zi Yan , Yang Shi Subject: [PATCH -V3 8/8] mm: migrate: Do not retry 10 times for the subpages of fail-to-migrate THP Date: Wed, 17 Aug 2022 16:14:08 +0800 Message-Id: <20220817081408.513338-9-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-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=T+C0sOZF; spf=pass (imf13.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) 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=1660724081; a=rsa-sha256; cv=none; b=8iaRL3ITb18ujkoESd/DHICAyjX4s6ccCQxfmVsPaoiS7dtUAEcS56WwkojEkiGdsDSe35 /EnKcQIlIMlY4jd031TDvu5HOXDkT0ZamJPbRHeGjV2i2gKij56eNMsYdpoyUYLyXVB5Nl ceROLJCjuGeMQESxI8HqRQqfjqE5FxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660724081; 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=4qRB0Lv47nO4CdWGbeMW0y9JkeWb7W1yANC/ZxSHt7U=; b=rYpcz6ksSvRNHyYXj0pNNOdyINIO2Y8Pp/6iotkIijDAUgWWrtjMJlm2p+B3CaSM2jBL4G OiyD7GlwC+sxZZiCCPG8VdxZYwsDSjhm/IeBFHuY3PIeKF2MM1SHKUGuBSO0OR1AanPkYG xj/v+5qts0Lur3eCtxSSdrAbVW+9mzk= Authentication-Results: imf13.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=T+C0sOZF; spf=pass (imf13.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: 3qm6da7y1y71gnbnpszd6n36j5g5ukkd X-Rspamd-Queue-Id: 2C46A201C9 X-HE-Tag: 1660724080-787526 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: From: Baolin Wang If THP is failed to migrate due to -ENOSYS or -ENOMEM case, the THP will be split, and the subpages of fail-to-migrate THP will be tried to migrate again, so we should not account the retry counter in the second loop, since we already accounted 'nr_thp_failed' in the first loop. Moreover we also do not need retry 10 times for -EAGAIN case for the subpages of fail-to-migrate THP in the second loop, since we already regarded the THP as migration failure, and save some migration time (for the worst case, will try 512 * 10 times) according to previous discussion [1]. [1] https://lore.kernel.org/linux-mm/87r13a7n04.fsf@yhuang6-desk2.ccr.corp.intel.com/ Tested-by: "Huang, Ying" Signed-off-by: Baolin Wang Signed-off-by: "Huang, Ying" Cc: Oscar Salvador Cc: Zi Yan Cc: Yang Shi --- mm/migrate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 55fbf9669431..06a653977835 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1522,7 +1522,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, case -EAGAIN: if (is_thp) thp_retry++; - else + else if (!no_subpage_counting) retry++; nr_retry_pages += nr_subpages; break; @@ -1548,8 +1548,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, } } } - if (!no_subpage_counting) - nr_failed += retry; + nr_failed += retry; nr_thp_failed += thp_retry; nr_failed_pages += nr_retry_pages; /*