From patchwork Thu Jun 20 01:27:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13704787 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 3AC6AC27C53 for ; Thu, 20 Jun 2024 01:27:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC7FA8D0097; Wed, 19 Jun 2024 21:27:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B766E8D0066; Wed, 19 Jun 2024 21:27:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3E9B8D0097; Wed, 19 Jun 2024 21:27:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 87AD18D0066 for ; Wed, 19 Jun 2024 21:27:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3C8CC16169E for ; Thu, 20 Jun 2024 01:27:19 +0000 (UTC) X-FDA: 82249528998.18.9B4BBAD Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) by imf13.hostedemail.com (Postfix) with ESMTP id 32BAE2000F for ; Thu, 20 Jun 2024 01:27:17 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="Y9W/okRq"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=kA3RPmUp; spf=pass (imf13.hostedemail.com: domain of zi.yan@sent.com designates 103.168.172.156 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718846832; a=rsa-sha256; cv=none; b=oZTvvxKy32Pu0I7F+9MFNpeU2QCpo62eZJgwTADbgdDndeeZpqDamtJqjMYm0I207OHEpW Cc6+vYCz6obRo/+vFlT4AOxgAYpwwZ/oIDpnpI+F+fH1cL/Jle8FAom8JNhxQZR5lRckRP ga6b1TY4wovhOCHhmCYDDNTetBb+3j8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="Y9W/okRq"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=kA3RPmUp; spf=pass (imf13.hostedemail.com: domain of zi.yan@sent.com designates 103.168.172.156 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718846832; h=from:from:sender:reply-to: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:references:dkim-signature; bh=k9foSFkePz9cBwUSIx+qhJ76EzRla1z5nODbQMDGUyw=; b=UBK9toYD9lUCLVcK1MFIJE9A8wsvTBTFoIpQJyL4DlxDPNkcBBe70TxgjnU03M6Ul3RaMk RSbH0BI+pRKJO0sLN3NY8xe+yrqoKbrPBGzNru9KSBKzwsOO8HP8kiOBADa3hP93ZMCGzP vgDS+QefD4vjkxspvkBeMT/yt3XxnZo= Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 6D001114022F; Wed, 19 Jun 2024 21:27:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 19 Jun 2024 21:27:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:reply-to:subject :subject:to:to; s=fm2; t=1718846836; x=1718933236; bh=k9foSFkePz 9cBwUSIx+qhJ76EzRla1z5nODbQMDGUyw=; b=Y9W/okRqn5OzHVjaMnL84Oz7Mm vesKSAL1dP78CkuGWuKRQMYR0fjUALK+z0Nd8AGKTbhe7NO4lbU/vYO3wwbNE1PZ nAlT4V1gVeVUGJ5MsyXEjzeDgU5cEABlzB5AJ8VkI6d255/EBJmBUrOaCNcxhao9 RlohSOPLIl5+1UaFR/4SyV7YIWjMUvjaRXWdMO2V/K3sz15rAf1gnPdNs4vnLC3e hro/UmkapcFG66W8w/jLc+Vcl2nPBCEAio7qrRC0d6jh51x1MUDhTLqfo8/EuUKy k3a73PRUoUfLlX1n0/tvJs0DdrA3PIWxzylr5fd6j9FOOM6TQCQVqGfyxmHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1718846836; x=1718933236; bh=k9foSFkePz9cB wUSIx+qhJ76EzRla1z5nODbQMDGUyw=; b=kA3RPmUprUBRXC7VjHr31NGCXf9ef EubGp8TF1o6vYFTr22oeu/uSWh99M8c2jqrWjYjfxV1Sy85TlklbxELZJa1xB/kf UJTJnbg9oIfe1NEAiZRYlcMsUS3So9ltGXlWg9wA/N8INxGOGUjDaLQthaNjXady ldFOZHHRyYZy9o707uH10vg4nXAuWURzw1ngw0lnlK6snldyQLnQ2MTAb0EfKMR1 OdWfHm8Kj/fvtK9CMyCzw2ZQogVt1OSwfNFfwLSbBk2aMvXrHCuY/SDA01ljiyxf RbrmllQPprqeeO7iMsoUsbapUHxeY28u0V4hcYnVO73vmJpXx8c2RsuVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeefuddggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofhrggfgsedtkeertdertddtnecuhfhrohhmpegkihcujggr nhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeeigeffgf egkeetudelueejveefieeuieffheduteetudeuffejkeffhfettdeihfenucffohhmrghi nhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepiihirdihrghnsehsvghnthdrtghomh X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Jun 2024 21:27:15 -0400 (EDT) From: Zi Yan To: Andrew Morton , Hugh Dickins , "Huang, Ying" , linux-mm@kvack.org Cc: Zi Yan , "Matthew Wilcox (Oracle)" , Yang Shi , David Hildenbrand , Yin Fengwei , linux-kernel@vger.kernel.org Subject: [PATCH v2] mm/migrate: make migrate_pages_batch() stats consistent. Date: Wed, 19 Jun 2024 21:27:12 -0400 Message-ID: <20240620012712.19804-1-zi.yan@sent.com> X-Mailer: git-send-email 2.43.0 Reply-To: Zi Yan MIME-Version: 1.0 X-Stat-Signature: 47ih53izkzx1hy8fmhyjbc6cfawd8zdu X-Rspamd-Queue-Id: 32BAE2000F X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718846837-934082 X-HE-Meta: U2FsdGVkX18p+eH6j6F0vRpIciORzklWsPMFEPf2eZv22UCtZ8ar/g0yKLvDLyV/LhmdS2L0lvQuDoZfbhT4PjJoBAYoz/7GWGJg3o7IPTNHTn27bFj69vS6tJGHOkUOWFloeVUpxqErQUYav1go31ZR5UkZaINf9N0EjrvPJzJDXby4HaQsrHWdKNtMWGJ3V+Dk/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xby4XcUg/0PDYK7jnfSqi+BLm4HesuWW/vgGR3bgw6UfHPwGbdPJqcWGEfG/nkpBGquCFcgPU5+EzIFU0NwH6/GBrW3tubmSGqi41C5LHZ04Me3aRGkREU3y8xzaa2+iNu0xMPhx64ln+2bkf/CQcrnQNzPK71nzEHbGYLbMXqObnUkBh3Qf+g1aMsFG1aryq+IOjI9UmaoMrZmWxE50RDh7eS7kFH+XLBnrCJuzu/EvaSFitAhpjgtKxhBlYcXcpxbkYoE 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: List-Subscribe: List-Unsubscribe: From: Zi Yan As Ying pointed out in [1], stats->nr_thp_failed needs to be updated to avoid stats inconsistency between MIGRATE_SYNC and MIGRATE_ASYNC when calling migrate_pages_batch(). Because if not, when migrate_pages_batch() is called via migrate_pages(MIGRATE_ASYNC), nr_thp_failed will not be increased and when migrate_pages_batch() is called via migrate_pages(MIGRATE_SYNC*), nr_thp_failed will be increase in migrate_pages_sync() by stats->nr_thp_failed += astats.nr_thp_split. [1] https://lore.kernel.org/linux-mm/87msnq7key.fsf@yhuang6-desk2.ccr.corp.intel.com/ Suggested-by: "Huang, Ying" Signed-off-by: Zi Yan Reviewed-by: "Huang, Ying" --- mm/migrate.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 7c4c5a2ebbcea9031dbb130bb529c8eba025b16a diff --git a/mm/migrate.c b/mm/migrate.c index 66c74b89d3de..781979567f64 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1645,6 +1645,10 @@ static int migrate_pages_batch(struct list_head *from, * migrate_pages() may report success with (split but * unmigrated) pages still on its fromlist; whereas it * always reports success when its fromlist is empty. + * stats->nr_thp_failed should be increased too, + * otherwise stats inconsistency will happen when + * migrate_pages_batch is called via migrate_pages() + * with MIGRATE_SYNC and MIGRATE_ASYNC. * * Only check it without removing it from the list. * Since the folio can be on deferred_split_scan() @@ -1661,6 +1665,7 @@ static int migrate_pages_batch(struct list_head *from, !list_empty(&folio->_deferred_list)) { if (try_split_folio(folio, split_folios) == 0) { nr_failed++; + stats->nr_thp_failed += is_thp; stats->nr_thp_split += is_thp; stats->nr_split++; continue;