From patchwork Tue Oct 17 16:31:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13425619 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 2E57BCDB474 for ; Tue, 17 Oct 2023 16:31:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 938C780042; Tue, 17 Oct 2023 12:31:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E75C8003F; Tue, 17 Oct 2023 12:31:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AEE580042; Tue, 17 Oct 2023 12:31:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6C9358003F for ; Tue, 17 Oct 2023 12:31:42 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 479231602E8 for ; Tue, 17 Oct 2023 16:31:42 +0000 (UTC) X-FDA: 81355494444.11.6CD7E3A Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by imf04.hostedemail.com (Postfix) with ESMTP id 0BBB840004 for ; Tue, 17 Oct 2023 16:31:39 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b=3yJnaArN; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=unfNfFs2; spf=pass (imf04.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.24 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=1697560300; 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=0wvr21T8TH7ZbDsGZ1CdyvPwondpshaJK0kYT+cScfw=; b=EGkZ68o+25kKl5B+g2ofdDqFHEPGUd1dL8KmYVdqrKJhDeqIKXzOMIkcfF6CyKJeljhIAf UJA0Zs69Eim2SXMwkrGn1b59r2B6wAyhCBH0oRsZ/4mIKyufyREQ02unKflz+akG0+DbhG mUx8lEhBL27kqN7isUTWLSr3Q3E781M= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b=3yJnaArN; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=unfNfFs2; spf=pass (imf04.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.24 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=1697560300; a=rsa-sha256; cv=none; b=SMrrHQfIDVXoU4sZlxekbwLEu1jD86zdBJjcj5/a4yyuqTccGqCvoTvydtoftW+++xclZC rNgv3EPP5Da4NzinusOtRS8CcdjzAp1RiPKSi9xceJq2AQMsGMsaMOelT2QyZnm3tDcj95 0fGBdkqEGEoQKA7xM4w2KfTWPArbDkg= Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C0EFA320097F; Tue, 17 Oct 2023 12:31:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 17 Oct 2023 12:31:38 -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:sender :subject:subject:to:to; s=fm3; t=1697560297; x=1697646697; bh=0w vr21T8TH7ZbDsGZ1CdyvPwondpshaJK0kYT+cScfw=; b=3yJnaArN4SOYAmO1fp K+rmCwdS25C4YRLbYb0xacBS/armI4TMiZSw+anRkphttaPnf81i/MUhL4bTV55z ravLE/h5yQ4iGHaa9q+lHzdu2UTcYuwOa32+huyKdw2QNSGWNr8o8KqCwbnbQLxE WDZFZsAAqo+2HbVXG7gsU8kKCxbgtuz298uj2xt0bbycxccYD7NyZFOAsPRqDawn Z6HlnGXzLQSwHv7rPotAhmldY4xVBkO3EzXyUvtYzWJPHtl497Z9PatJ1yJ3nY3J ubAJCG0ZFs1uHMiVak5L3GNe/sxDWg7xocktRhJJFZvNRUJHnUpSEAJ7q69xnCDx 6xyQ== 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:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1697560297; x=1697646697; bh=0 wvr21T8TH7ZbDsGZ1CdyvPwondpshaJK0kYT+cScfw=; b=unfNfFs2TOOscLvAF rtISXudCcuRuLCPnvkyTpJifO7QIISSb3fmEx9IHVybsZWcTf+QCy1nfKYraT5uP 5sY0vQQytBofwThnmDC1UHIE2JCAHDIh1zxN6bWP9zwDhlqHEN/mwy+gSfyeYPM1 zUEyKLpE7axpayZRP8cwKcUauSPCm/XR9NGvmH3E45hoZ3k1IK8ecXr+oRN18A0d Ia+cr/9I8OcTqW/pdRNBS7pwUihug/MyG94NZLIeW774ls2gIH92rUi9LKZNqy9Q 0u4rqE+jFZKvLndXMnAUGVNHe/+14vPmt3jOBh8OFrCsnoBBFgFBkDx3cFa8q1bd kId/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjedvgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfforhgggfestdekredtredttdenucfhrhhomhepkghiucgjrghn uceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepffejueeife ejudejudfgiedtfeeltdfgueffhfdulefgtdekteekfeejheekhedtnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepiihirdihrghnsehsvghnth drtghomh X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Oct 2023 12:31:36 -0400 (EDT) From: Zi Yan To: Huang Ying , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Zi Yan , Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand , Baolin Wang Subject: [PATCH v3 1/2] mm/migrate: correct nr_failed in migrate_pages_sync() Date: Tue, 17 Oct 2023 12:31:28 -0400 Message-ID: <20231017163129.2025214-1-zi.yan@sent.com> X-Mailer: git-send-email 2.42.0 Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Queue-Id: 0BBB840004 X-Rspam-User: X-Stat-Signature: e8rsih9an13k8wmpcxgx4t8tenm1p3d8 X-Rspamd-Server: rspam01 X-HE-Tag: 1697560299-386059 X-HE-Meta: U2FsdGVkX18CkRFPGNhK+Ec8wdO1PZ+5dA2JNnZVRYweaqVRA2i6Us/VugJ9GkSmkksWjlf7PmD+RPLhzW4tYR9vvznt3kLOz1NBZv4WSwn/P2osKEEbln2cAevT4zQK7Bo5COY3hxv8y1cd2SeWXtmZxBRHdsYTla59+iiIQiSVao+bHVyWdI1Gb0j9Q2QRsw9+XHSIDnHoYDKqgdt21epxb0DU1qqLbe3viMuGtAGhgMJf3U4yAmznwR/Sfvp0KJTZyibay0e2qZJABEmH0Lo84cza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w6PPIQ62voIITels3EBIbEJqIfRTjj4GKdEO0AsNXVUulOh+PXRi81IgDjVoWtDhCd8wMlmg/+m3D4x9mQ4vFLkeE1KRp5GdkxxjO7jEuZ478Ha9i1+l6ZoCBLBB0bv2ZnUA3MRcUaavGx3+pQRrSYk/uyV5WvwGUGvZrlY5qTXDjwuU1DbjHNYuEeO+o7g3C3kM1xES+ioyAZJbeLZCoYvIrBYjW6MKRpTCZUyMzNRUY= 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: Zi Yan nr_failed was missing the large folio splits from migrate_pages_batch() and can cause a mismatch between migrate_pages() return value and the number of not migrated pages, i.e., when the return value of migrate_pages() is 0, there are still pages left in the from page list. It will happen when a non-PMD THP large folio fails to migrate due to -ENOMEM and is split successfully but not all the split pages are not migrated, migrate_pages_batch() would return non-zero, but astats.nr_thp_split = 0. nr_failed would be 0 and returned to the caller of migrate_pages(), but the not migrated pages are left in the from page list without being added back to LRU lists. Fix it by adding a new nr_split counter for large folio splits and adding it to nr_failed in migrate_page_sync() after migrate_pages_batch() is done. Fixes: 2ef7dbb26990 ("migrate_pages: try migrate in batch asynchronously firstly") Signed-off-by: Zi Yan Cc: Baolin Wang Cc: David Hildenbrand Cc: Huang Ying Cc: Matthew Wilcox Reviewed-by: "Huang, Ying" Reviewed-by: Baolin Wang --- mm/migrate.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c602bf6dec97..fc2e70b17704 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1495,6 +1495,7 @@ struct migrate_pages_stats { int nr_thp_succeeded; /* THP migrated successfully */ int nr_thp_failed; /* THP failed to be migrated */ int nr_thp_split; /* THP split before migrating */ + int nr_split; /* Large folio (include THP) split before migrating */ }; /* @@ -1614,6 +1615,7 @@ static int migrate_pages_batch(struct list_head *from, int nr_retry_pages = 0; int pass = 0; bool is_thp = false; + bool is_large = false; struct folio *folio, *folio2, *dst = NULL, *dst2; int rc, rc_saved = 0, nr_pages; LIST_HEAD(unmap_folios); @@ -1629,7 +1631,8 @@ static int migrate_pages_batch(struct list_head *from, nr_retry_pages = 0; list_for_each_entry_safe(folio, folio2, from, lru) { - is_thp = folio_test_large(folio) && folio_test_pmd_mappable(folio); + is_large = folio_test_large(folio); + is_thp = is_large && folio_test_pmd_mappable(folio); nr_pages = folio_nr_pages(folio); cond_resched(); @@ -1649,6 +1652,7 @@ static int migrate_pages_batch(struct list_head *from, stats->nr_thp_failed++; if (!try_split_folio(folio, split_folios)) { stats->nr_thp_split++; + stats->nr_split++; continue; } stats->nr_failed_pages += nr_pages; @@ -1677,11 +1681,12 @@ static int migrate_pages_batch(struct list_head *from, nr_failed++; stats->nr_thp_failed += is_thp; /* Large folio NUMA faulting doesn't split to retry. */ - if (folio_test_large(folio) && !nosplit) { + if (is_large && !nosplit) { int ret = try_split_folio(folio, split_folios); if (!ret) { stats->nr_thp_split += is_thp; + stats->nr_split += is_large; break; } else if (reason == MR_LONGTERM_PIN && ret == -EAGAIN) { @@ -1827,6 +1832,7 @@ static int migrate_pages_sync(struct list_head *from, new_folio_t get_new_folio, stats->nr_succeeded += astats.nr_succeeded; stats->nr_thp_succeeded += astats.nr_thp_succeeded; stats->nr_thp_split += astats.nr_thp_split; + stats->nr_split += astats.nr_split; if (rc < 0) { stats->nr_failed_pages += astats.nr_failed_pages; stats->nr_thp_failed += astats.nr_thp_failed; @@ -1834,7 +1840,11 @@ static int migrate_pages_sync(struct list_head *from, new_folio_t get_new_folio, return rc; } stats->nr_thp_failed += astats.nr_thp_split; - nr_failed += astats.nr_thp_split; + /* + * Do not count rc, as pages will be retried below. + * Count nr_split only, since it includes nr_thp_split. + */ + nr_failed += astats.nr_split; /* * Fall back to migrate all failed folios one by one synchronously. All * failed folios except split THPs will be retried, so their failure From patchwork Tue Oct 17 16:31:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13425620 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 572EACDB483 for ; Tue, 17 Oct 2023 16:31:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7D2680043; Tue, 17 Oct 2023 12:31:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D2ECD8003F; Tue, 17 Oct 2023 12:31:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B804F80043; Tue, 17 Oct 2023 12:31:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A10248003F for ; Tue, 17 Oct 2023 12:31:44 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 77D16120D8D for ; Tue, 17 Oct 2023 16:31:44 +0000 (UTC) X-FDA: 81355494528.06.BDF2A8B Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by imf21.hostedemail.com (Postfix) with ESMTP id 3E0701C0020 for ; Tue, 17 Oct 2023 16:31:42 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b=unvXa1k4; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=PJ7gUlT3; spf=pass (imf21.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.24 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=1697560302; 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:in-reply-to:references:references:dkim-signature; bh=1kkUVLmhYZKWaHKAN/xp7aL8gGntQ2zJwQBI6DdNoNU=; b=GxQ490u9za36jPlhp9jPJ0vHfdPoIk8wemzMAgqVAzJIgnkZTjsQ/UMQZz9X7NPheiE5Fo 7JV0DgvGZaFKRE9iiJjXOjGBTbd6XNCXowJvz81yPIAQeJqPI32EU3rTHqun2hfUfWj5V6 gmv5K1govhafIcWHGKN2hnhRbLrzAq0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697560302; a=rsa-sha256; cv=none; b=21oJa8jQYnUK6w5XMHGJD6ubDG8e8wzQunMJNxT04jNnlxBmXPv6AY1Zp38IMSmuT9Y3Hw xw/neRzLV5j9n+zozHsIhXzTs91IQwp5tnIF7kFKj1jquxdUZp9C2R1wRIP/M1PGFWiiLv tW55YzPk0Z9XS1ND2hQXOIZiU8o4UOk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b=unvXa1k4; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=PJ7gUlT3; spf=pass (imf21.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.24 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id EFF983200A2B; Tue, 17 Oct 2023 12:31:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 17 Oct 2023 12:31:40 -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:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to; s=fm3; t= 1697560299; x=1697646699; bh=1kkUVLmhYZKWaHKAN/xp7aL8gGntQ2zJwQB I6DdNoNU=; b=unvXa1k4H/Q7Jd14QuUPoZ4jcQPo5sBEh1o0/eDJkujCX6U7beP nLH41Xgpe4pvssOe6gtCU9QDPKGBdlvmDNw4yxg1llrYmG8knOVw/82VQq96Uwo4 6y6K9KLnFIWYY3kACqOdaJaBGKfF9AueTa2/7h6p+RBBh+QTPGQanQj9wbhPs2Wc RObbk5G5SE2pHWZgMvenTvoEusWbtcSWWmmHuwjDmMNjbriu8zD7FZxSScFyAU++ bcV6VUTUXfKhq3wfxGM89ExEcpII8cZ6IrOOTlxZetRzEtRdkQ9PWg54NXwJfeXa db1DXiSSJ6kc0rwPgl0NRBV+67mJh28LPSg== 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:in-reply-to:message-id:mime-version:references :reply-to:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1697560299; x=1697646699; bh=1kkUVLmhYZKWaHKAN/xp7aL8gGntQ2zJwQB I6DdNoNU=; b=PJ7gUlT3xyf2PcJF4ucbSQ9erQHE7TVNVKbQYEiQccw2LMr40XW 71t0mIFiDHwU4EOH6jKK1Mvv2PiFJrJBczuUX81w3okgCFxj+oom9KFTeMWGr6Ey 0YCiJK00XtIx1YyCPmmmVx4wvdlGMb43WsGLGcFprGjRiz1dToZodBSvGzPWPRHW euWGW61zhbCNpC1/GbbtJ+l4AKkyo5D1CCqGrOfu4vhuOlNg8llOABZBMEKSt8nE wdVEqOO1xLiNa63xg3rv7WQNJI4N/P3R7h/FLa82D0MY+YGv8tQNOJl0wm/5i4XC o3OkMlTpIDG52BWMZPM+GuDMGSCYifZiSZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjedvgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfrhgggfestdekredtredttdenucfhrhhomhepkghiucgj rghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepudfgfe elhfekiefgtedvudfghfduffefieefffejvefhlefhhffgkedtfeevhfevnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepiihirdihrghnsehsvg hnthdrtghomh X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Oct 2023 12:31:38 -0400 (EDT) From: Zi Yan To: Huang Ying , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Zi Yan , Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand , Baolin Wang Subject: [PATCH v3 2/2] mm/migrate: add nr_split to trace_mm_migrate_pages stats. Date: Tue, 17 Oct 2023 12:31:29 -0400 Message-ID: <20231017163129.2025214-2-zi.yan@sent.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231017163129.2025214-1-zi.yan@sent.com> References: <20231017163129.2025214-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Queue-Id: 3E0701C0020 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: jcnz6tam99nwaz9du77uax6xdtemwr19 X-HE-Tag: 1697560301-303463 X-HE-Meta: U2FsdGVkX188XvpO2GQcxqtYuBd7/LKBTJJ1KgTZkPw6HotlvgFbv6P21r43K0VdOiG3DX0upCwcX47LzqGKN7wsbJ0VfLZmkAibiFkI8dSdMa6xO1OHlIpgR1TxqUhsxcE6h1vxq/z57A8DgXCsGiGxUcboVpB/V7E5150q1SR48rzjJsYQy/5URXWY5c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p0kZMLrPhldOM4mzxuCewZZpHf5VHm46wP6CaQLLFx42DLbMQhdRpIg8pCz4Uo7iDPF9pKBSVqhetRwIcJEvWCKu3WhwLRYbHiHCDz6DOnl+I+fixez2KueWIMpSwK3hhTkOeLyDGaOC8Ik0iAfBYbu1vGl+4cY+Rx2FXsrU0xYw2Bx5RDcvrBXbq/9GvL8FL92XKiogU1CFjZgSeomaBdQbxxn6N2wuCmld5QJKD4kBXLex3AGofjC1Etx1EwPFjO3JPRbupq7ktXtjWgM9lIGbKpS6rHaJhf01XTNxL8ZCUYEV2ic1ORexkeJp7rE5eZjzrXaYmmK5wBXK/H00owxk= 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: Zi Yan Add nr_split to trace_mm_migrate_pages for large folio (including THP) split events. Signed-off-by: Zi Yan Cc: Baolin Wang Cc: David Hildenbrand Cc: Huang Ying Cc: Matthew Wilcox Reviewed-by: Baolin Wang --- include/trace/events/migrate.h | 24 ++++++++++++++---------- mm/migrate.c | 3 ++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h index 061b5128f335..0190ef725b43 100644 --- a/include/trace/events/migrate.h +++ b/include/trace/events/migrate.h @@ -49,10 +49,11 @@ TRACE_EVENT(mm_migrate_pages, TP_PROTO(unsigned long succeeded, unsigned long failed, unsigned long thp_succeeded, unsigned long thp_failed, - unsigned long thp_split, enum migrate_mode mode, int reason), + unsigned long thp_split, unsigned long large_folio_split, + enum migrate_mode mode, int reason), TP_ARGS(succeeded, failed, thp_succeeded, thp_failed, - thp_split, mode, reason), + thp_split, large_folio_split, mode, reason), TP_STRUCT__entry( __field( unsigned long, succeeded) @@ -60,26 +61,29 @@ TRACE_EVENT(mm_migrate_pages, __field( unsigned long, thp_succeeded) __field( unsigned long, thp_failed) __field( unsigned long, thp_split) + __field( unsigned long, large_folio_split) __field( enum migrate_mode, mode) __field( int, reason) ), TP_fast_assign( - __entry->succeeded = succeeded; - __entry->failed = failed; - __entry->thp_succeeded = thp_succeeded; - __entry->thp_failed = thp_failed; - __entry->thp_split = thp_split; - __entry->mode = mode; - __entry->reason = reason; + __entry->succeeded = succeeded; + __entry->failed = failed; + __entry->thp_succeeded = thp_succeeded; + __entry->thp_failed = thp_failed; + __entry->thp_split = thp_split; + __entry->large_folio_split = large_folio_split; + __entry->mode = mode; + __entry->reason = reason; ), - TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu mode=%s reason=%s", + TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu nr_split=%lu mode=%s reason=%s", __entry->succeeded, __entry->failed, __entry->thp_succeeded, __entry->thp_failed, __entry->thp_split, + __entry->large_folio_split, __print_symbolic(__entry->mode, MIGRATE_MODE), __print_symbolic(__entry->reason, MIGRATE_REASON)) ); diff --git a/mm/migrate.c b/mm/migrate.c index fc2e70b17704..1fecebf4c301 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1979,7 +1979,8 @@ int migrate_pages(struct list_head *from, new_folio_t get_new_folio, count_vm_events(THP_MIGRATION_SPLIT, stats.nr_thp_split); trace_mm_migrate_pages(stats.nr_succeeded, stats.nr_failed_pages, stats.nr_thp_succeeded, stats.nr_thp_failed, - stats.nr_thp_split, mode, reason); + stats.nr_thp_split, stats.nr_split, mode, + reason); if (ret_succeeded) *ret_succeeded = stats.nr_succeeded;