From mboxrd@z Thu Jan 1 00:00:00 1970 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 76899C04A68 for ; Thu, 28 Jul 2022 06:18:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 837EC8E0001; Thu, 28 Jul 2022 02:18:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E7986B0072; Thu, 28 Jul 2022 02:18:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AF428E0001; Thu, 28 Jul 2022 02:18:16 -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 5AE996B0071 for ; Thu, 28 Jul 2022 02:18:16 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1FC55120EAF for ; Thu, 28 Jul 2022 06:18:16 +0000 (UTC) X-FDA: 79735503792.19.DCBD7EF Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf21.hostedemail.com (Postfix) with ESMTP id 4BB6E1C000E for ; Thu, 28 Jul 2022 06:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658989094; x=1690525094; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=Rwc/qniW/RO2BA+uBG6gExEBv7Fj2QLZKI7Go3cAQKw=; b=OR91prHvCD8NCcBS8Abu6vH9gbSHe3IkUC07bHC8nSHwymBMU3nV+DKM 7fPBgS6hQggz0VebK2u101A43dvsP9MJuk9av8tEJc1phyP4qs14eyk4x xreXi6YEzTFfbWmLUUoHc9IWcNTbOc4ynG5HgHWKnvYwHPyywhuBah0ts UokTN0egszUQ8KV2WX76lHWkZvaZB2SmzQ5GPjXLTJISIWLpH1NHQvT/h OKyPmG3GbEsJIuWCnj/RJtLN28bilqb0C2OYL85fDsM1uua465m9KsSWZ hiUpSfOn8PINKBm9AkLv6lkvHMC6q4w4bxfpW0iZM9FaN/R/KvONVRTpL Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10421"; a="314217965" X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="314217965" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 23:18:12 -0700 X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="576311730" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.13.94]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 23:18:10 -0700 From: "Huang, Ying" To: Baolin Wang Cc: , , , , Subject: Re: [PATCH] mm: migrate: Do not retry 10 times for the subpages of fail-to-migrate THP References: <1658405108-100658-1-git-send-email-baolin.wang@linux.alibaba.com> Date: Thu, 28 Jul 2022 14:16:35 +0800 In-Reply-To: <1658405108-100658-1-git-send-email-baolin.wang@linux.alibaba.com> (Baolin Wang's message of "Thu, 21 Jul 2022 20:05:08 +0800") Message-ID: <875yjhoj7g.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658989095; a=rsa-sha256; cv=none; b=VHAyTBcz2yG1Ds7+38JwUhIFWc67GDCJ0acsuCEMnVvUctvWyiRUIjpjGSc9aPjFC7tute 5P+dKhYyIx24YQGJZgWAQDL7kaS2cJmt8b8UaDpjpZsYhWFdAxPE6boL8yA2Ovt3ALZLkU P0NbI5tHBp9edZE8a6LlHGQWvu+bJ2M= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=OR91prHv; spf=pass (imf21.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658989095; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QePZRSXS484swZcbwb0NyIHM0+Ce8gsFojerD29IvAw=; b=QHT5RFoxr6PuqY9NcB2MqMAn5wI9rDObZawPF7HBr/OEUfNeZ0g9Lv2bxnt9aiQB4dMfts +e4kzZGy0fw9IsHwSDQZS5OjeAWs61ypHbVYMDnESRM+UeMUt5qG17W9Ufo8wHVrcuOCZI kSJld0LVz8fl0cOVvdyj0b4z/pk3hgg= X-Rspamd-Queue-Id: 4BB6E1C000E X-Rspam-User: X-Stat-Signature: au4d4zeyqizp36x1x31xdife9je1mxap Authentication-Results: imf21.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=OR91prHv; spf=pass (imf21.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam08 X-HE-Tag: 1658989094-73538 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: Hi, Baolin, Baolin Wang writes: > 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/ > > Signed-off-by: Baolin Wang I have tested this patch, and it works as expected. Tested-by: "Huang, Ying" > --- > Note, this patch is based on the patch set [1] from Huang Ying. > [1] https://lore.kernel.org/linux-mm/20220711084948.274787-1-ying.huang@intel.com/ Please this patch is based on my patchset that hasn't been merged. I can add it as the last patch of my migrate_pages failure path fixing patchset if you don't object. Best Regards, Huang, Ying > --- > mm/migrate.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 8429206..e36a084 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1507,7 +1507,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; > @@ -1533,8 +1533,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; > /*