Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4542803rwb; Wed, 17 Aug 2022 01:38:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR7VTayLL0+Duiug3gu557cR9lFyp0SqYvPtTvjom/34HXfCH2xtmGKoPTOJZhpcNDFLi2Bs X-Received: by 2002:a17:907:1611:b0:733:636:5686 with SMTP id hb17-20020a170907161100b0073306365686mr16232202ejc.226.1660725525142; Wed, 17 Aug 2022 01:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660725525; cv=none; d=google.com; s=arc-20160816; b=crpfm+yhbI/dBYdegduNecOivi+7Lzu5kaFKZlZKyo8DIljtJqOh+x+LLc7t+cDTmV sCdS2+DJlu0V/EYsku0S1EZW1G/WOhJ1VL63jxIqtunYijp5MZ0IvY1eCRUWqgeXs/Sg QzQYdcVEXlusN50jntAk72Wm4bm6dt0x1pIKzJUT/9/PyuEoco8vUvV6CINJTSIBt8jp L9usZe6bPYjP/Xb80VOJCixdhjcujtn+pqXbzlNvPkPTyekLcGNrrSHIWV7WLbxhspu4 OlA/LcLk48wHmk+x3Nxr36ZTa562kiSgDkxxyRnxwP5QLb4S2lqcSIz5m0uhzlt+ORVQ haBA== 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=4qRB0Lv47nO4CdWGbeMW0y9JkeWb7W1yANC/ZxSHt7U=; b=DwSS/LRBxtXTdlcA0pLc1qJfSAUsCtvD/tRZzx9lbq1wRIuPLosHwezRRONKXNzvxO 4G78QJ/natAhKZWqK2Sz7rT43XIn54jMhiGigvItIuXIMpbVDTVcwuEE3MOyplBpTRl3 J2+AMQvJoJucrYQPZZvtqSEl8nTwM5BHSgn/ousPhGiUgl3YY74iAByNe/Ro+f/pS2ec rd0RwP9zNIRaq+mzNguoArAfqsCj7hHMMzD3/nAFKAgKl3IOu15WAPiZA4GBOkMGg81U 29itWtnzhpHk5IcDJSNTWz7FHtFkNWDWI8ordlmuwTOQxq7Q2IbioL0MnhLorr3BoCbB 1hTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kK8PV78s; 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 gu20-20020a170906f29400b00715867834e3si10237496ejb.506.2022.08.17.01.38.20; Wed, 17 Aug 2022 01:38:45 -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=kK8PV78s; 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 S234696AbiHQIQJ (ORCPT + 99 others); Wed, 17 Aug 2022 04:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbiHQIOx (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 B21DC5A896 for ; Wed, 17 Aug 2022 01:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660724080; x=1692260080; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CfWZdev3ddt5aOgW4WxIwyKcDYIQwXT1f+c+rDGkzjw=; b=kK8PV78sbIBjiyYEP2mBhyaQxQgI/ICHiyamxtCELGDgotGjyEfuhZ9W 8s+8f7V1udX+pTXgvujWOxyAKovsVO66Wu2UvyEKLxKWLVX1X3mVfSyra D5MHYcJx2IPn/EiKuyp9EeD1jCLc8HSGhp80hRpIT9HzQ/f/YtE2iul5l 2vACvya3fwG47QK4P92tX5c4phXX4HNm02H8jj7D2jRoRdJJ6ByL30WzD 25q46qnnsHL3aEenvikBKknxG7fP2M1hjfLmIr4gR+OdKk4S/64Bc1U/T jsAbAWX2SVDrP9nXP5K/I9J1OQahpaXdODmSe4bFMuTmrTmdIXQ3wktcx g==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="293228871" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="293228871" 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: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 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 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; /* -- 2.30.2