From patchwork Tue Jun 18 13:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13702284 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 CDA79C2BA18 for ; Tue, 18 Jun 2024 13:42:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0015D6B0248; Tue, 18 Jun 2024 09:42:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF3B96B024A; Tue, 18 Jun 2024 09:42:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6CD06B024D; Tue, 18 Jun 2024 09:42:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B8E8E6B0248 for ; Tue, 18 Jun 2024 09:42:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 404191C1772 for ; Tue, 18 Jun 2024 13:42:18 +0000 (UTC) X-FDA: 82244123556.29.5A3E26D Received: from fout1-smtp.messagingengine.com (fout1-smtp.messagingengine.com [103.168.172.144]) by imf30.hostedemail.com (Postfix) with ESMTP id 20CDC80014 for ; Tue, 18 Jun 2024 13:42:15 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b=i1hXgQHe; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=FARhaj1R; spf=pass (imf30.hostedemail.com: domain of zi.yan@sent.com designates 103.168.172.144 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=1718718133; 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=1rMFbhFWb3xr4q6NG/BsEtMpY09blv8NLf6aid/bJqw=; b=prlhY4//mIQ+49d7p42EWfxvOUO3w3sg21okWZUF1hS8FQBP3k/Fk2ljXk7qXc1eVDLG5+ AZoO7cX1aLtPjVujTlumr806HcY0lVGp322E5tM4/ifvIG9ebs+HkTEbA1OkgV2VnyOIZy d6+LQaNE5TeoX5fYtW/r5GQc3fcrB00= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b=i1hXgQHe; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=FARhaj1R; spf=pass (imf30.hostedemail.com: domain of zi.yan@sent.com designates 103.168.172.144 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=1718718133; a=rsa-sha256; cv=none; b=RCO+2lNvhRt+ZNA2NQq3PNvsEe+xLD64Otal2LOqmQb7nLG7LTu+K+0Qz77JPceCTkOn3Z zY9U34L1yh4RGNc3Mfx6mll4mwNAXuToTcvWamWAHJPqtWOEbSrHLuA5bRxJFRzfMhn5On ceTYLWHedJAI2TOqJKd+GaIlHe1VLtI= Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 59CD7138016D; Tue, 18 Jun 2024 09:42:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 18 Jun 2024 09:42:15 -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=1718718135; x=1718804535; bh=1rMFbhFWb3 xr4q6NG/BsEtMpY09blv8NLf6aid/bJqw=; b=i1hXgQHeKoWylV/OSeiU5Zc4nt zS/4q5NWtStL/LXiE7yfpC9X7W4+0z0bMXJgcvYE+X18dcOYCZvi9IsN+rAdYGrj KIuXQl57hJFeLThBqvH6wZLgKd7qLIDJD3qQZOHPptDjfgId832nkFZ/e5bMOaWA +v2jTuVRnU6tkM6fxQLIDAZZKFmpmuyaXzZ+hJga7Xyn37z5ptKvhABjNFSevj26 R/RiOvOsgu2R1nFZ2CoeZeXSr/MueL2USuNFMyheO9CvrnBIw9BOXvEUAar0WcNL D7nfz82oz1SChCp2xXvFeWAC9QdcNmPgeE4bY3w+B2d06MDwq8RRx5XO4LmQ== 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=1718718135; x=1718804535; bh=1rMFbhFWb3xr4 q6NG/BsEtMpY09blv8NLf6aid/bJqw=; b=FARhaj1RJe2S/grLAEPH7BZEyjLF6 nwX4CWcuzt6WnVRYqaI1ZU1UnaBsIwOv+ZOWE1vB/hQPnj7Cxk7/eIrcfmgC9ksx VUo/PVEfHJMROv0AMsi/aoMArrTGfxh/vSfYGK++RycjJYPgXzn4hqF33fWMu0YQ kPwQjJ0Bep6Sm0j5PEtDUTnpbBR/TSou/+g34/oFa+lGluXPBsCp7nXSTLcmhAZZ gdLpOG+FyjC7TS9PGAjk1nbDtF4VF9moJsaw9l7ZX7dE/eHuy3uHl7/4PqVzthHS 9vE2V6VZmgkFKD51C9ugnimBjEF00DjYBjIkhL4JcLikUD3oCamShya7A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvkedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofhrggfgsedtkeertdertddtnecuhfhrohhmpegkihcujggr nhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeeigeffgf egkeetudelueejveefieeuieffheduteetudeuffejkeffhfettdeihfenucffohhmrghi nhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepiihirdihrghnsehsvghnthdrtghomh X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Jun 2024 09:42:14 -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] mm/migrate: make migrate_pages_batch() stats consistent. Date: Tue, 18 Jun 2024 09:41:51 -0400 Message-ID: <20240618134151.29214-1-zi.yan@sent.com> X-Mailer: git-send-email 2.43.0 Reply-To: Zi Yan MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 20CDC80014 X-Stat-Signature: 39pihjruap3gen7urf6rbdqf3z1n35or X-HE-Tag: 1718718135-413853 X-HE-Meta: U2FsdGVkX18TIQyiMJxM7DlB6cyRw0l6iKqolIhtrvjotnek17JKRHUOwPIcpO9yCfxzMJ3kyJE+KkEuRZVjA+ysep298OvbGbxM5qEERsabZ1UG91b+IJ8Npl48Kl9I8B1ifu0Yw/TJ5JzAnJ/7dkdIsnmtJNed2n9FhNakg/Hkj4GM8GbRd+YXovKKIKmvRrv+gORyor24z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IKO88ttXEn5I7TcE0Vmmp5KYf52M1sOBH3NjIEujIG76V6ko+veJjCnRht/2zHfKsw1TcI/FRomh2ehw3TwAtOH3iyUXSxg86axphhQpJOt6q5qcdfuG3Ysdw3pybS6LOUCiWGuxwqdWs84eoIC9bNbNv8Ug7jXsshWpEGaQQS8MT5rFx+PbqYloIzVOSE4oghw8fXKJLmHcE5lHCqHq9IfxpiuWajgax+pvM09KF3Xw9tl2 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(). [1] https://lore.kernel.org/linux-mm/87msnq7key.fsf@yhuang6-desk2.ccr.corp.intel.com/ Suggested-by: "Huang, Ying" Signed-off-by: Zi Yan --- mm/migrate.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 14d7c92f8df9c0964ae6f8b813c1b3ac38120825 diff --git a/mm/migrate.c b/mm/migrate.c index 2cc5a68f6843..20cb9f5f7446 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1659,6 +1659,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() @@ -1675,6 +1679,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;