From patchwork Mon Oct 9 20:32:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13414403 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 C2039CD6137 for ; Mon, 9 Oct 2023 20:32:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48D186B0190; Mon, 9 Oct 2023 16:32:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4157D6B019C; Mon, 9 Oct 2023 16:32:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B6156B019D; Mon, 9 Oct 2023 16:32:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 15F286B0190 for ; Mon, 9 Oct 2023 16:32:47 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D6C73A03D2 for ; Mon, 9 Oct 2023 20:32:46 +0000 (UTC) X-FDA: 81327071532.27.BE302D8 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by imf17.hostedemail.com (Postfix) with ESMTP id C8DE54000C for ; Mon, 9 Oct 2023 20:32:44 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="HO/OHuE6"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=cxlJl5XS; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf17.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.25 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696883564; 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=SzCcXEw24lbVQoLDSre4+93FDqVAU/sVIvBTCkxblE4=; b=XYtyMMgo98d321kI2TcD0nlidw96oIcQo2OPs18L5BWbawug1rvtzvT0HbQQxz2lCI1xsL AXw2RnkjhmQC+PrcadAEdqTYN7zkC6gNd/J9iBUBnHFQ00Dfji6BhofG9OXKPdQ2ObO+iC voPBLpSQG8R8tWngmhcoG9JOJvYGEKk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b="HO/OHuE6"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=cxlJl5XS; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf17.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.25 as permitted sender) smtp.mailfrom=zi.yan@sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696883564; a=rsa-sha256; cv=none; b=OpKq1xGP5NlXX7AGNvA10mXMbl/KBETjOc9ORGf9AlQfI6KJwIq9D+QelG6A/RIBGaa+m0 CnVkbHwYpHrgHBT4oTWMY3i1Airl3Ke+WSdywsLmqWvf2JwXicLDDpsks+jr/ZDcEnduW+ z7SZrj05Vkiw2kXoaPQDDtJKZPdXeCE= Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 275C35C02BB; Mon, 9 Oct 2023 16:32:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 09 Oct 2023 16:32:44 -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=fm2; t= 1696883564; x=1696969964; bh=SzCcXEw24lbVQoLDSre4+93FDqVAU/sVIvB TCkxblE4=; b=HO/OHuE6kHokYBVlkHykez21S6VDvdr5Gdj8uzoCr0GpVgruifQ z2EvzdEc+i0Ot5AnVWz81RGSHnjudXQ3xUD78PWToBX5Vs7YmxhAzj9MuA1VV3pa NvcfEuKgRJr2JZ1jmj3V/QQ+wSr4egq/dPryEiVVBOUnQrXr8ErC9hMzMn3bvsrP poeEHolD3/Zfe6YFV82couRd50Ghdk8/PX//RP7dvKHtJF5cjwo3KtbAMeD6Gdlt rC3s/dcipacwuf/C/VDG9uDgFmQ8uxwGZMVPBK7/oUIbJpJ/rp9K7U4MFNmHgSoK CkOmG07Dd1Q7Qohy6B3fFUpsd3bGoJWqMCg== 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=fm2; t= 1696883564; x=1696969964; bh=SzCcXEw24lbVQoLDSre4+93FDqVAU/sVIvB TCkxblE4=; b=cxlJl5XSYwGSdUJuN2SWs1jXmMEgUjXvWe4uTI5C4XzeZIQJGEu RX4VJvhg0Nlb1xSdbHG/RcmJg+Krgga5HiWDk6/WszGY7n8bjJ0pPz1SaZU1L2xs KEItHfvP6P2dtzh6U6h0nkMBcUvVjyckqXnlqFF0Po6r6ye+KOjyiy9886Udb8pC AcfRDwY6G3Sgc3CEyzzWzzDL5GBw0Gn5U/QKRk22o8D/FtidDp5JAf5IPVDuh9Tg RXS7QzAh8HH+I9mIG4avSNNpWVtUlyFtUMVPflGqwbovIQM0YY0VtWB1GRypz95T eV0C4cDS3Mh6RouqBqijHJPDa7vHt1liCAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrheefgdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhhrggfgsedtqhertdertddtnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeegge ehudfgudduvdelheehteegledtteeiveeuhfffveekhfevueefieeijeegvdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Oct 2023 16:32:43 -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 1/1] mm/migrate: correct nr_failed in migrate_pages_sync() Date: Mon, 9 Oct 2023 16:32:31 -0400 Message-ID: <20231009203231.1715845-2-zi.yan@sent.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009203231.1715845-1-zi.yan@sent.com> References: <20231009203231.1715845-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C8DE54000C X-Stat-Signature: ky95mzgocb9x5wekhkpbqx7kstdbcpcr X-HE-Tag: 1696883564-42547 X-HE-Meta: U2FsdGVkX1+DN2eAPTAtWXgJ8mOMCN+UfZhiorcWqDos0hEzZDEihgbYrhAo5SIoKnEX1qFRvT6UFVxspZdNqMDexM3IbywlTL+ezTnpJ/mXTF8YBFFNvzgfz37FVf0yMdf6w48cSYTL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bq3BykQcCs32A8lT9hUbgfI5oU0ravSUe/6UbKwy94tYDprMVl9sV7LB3HVIB7DmnAdkxQmtV0brXTgDAoRj7iRQq5vOo8j/nkdGYaMWjXbuWoU5radY9YXzssj79KValyjoIbT5jAPcSGeiMS5AKV8VHpfbWu9hXTxYK2xVeelPyd9COaf7Vh06alFiHS1LxoChp1V1RFgtVdpGU2MYLLthMbbkWS7otagpsHLgQUvEnLGjmo81RJMpvPbCaPvo2WNlaysX02LhQ= 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 rc value 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. Fixes: 2ef7dbb26990 ("migrate_pages: try migrate in batch asynchronously firstly") Signed-off-by: Zi Yan --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index c602bf6dec97..5348827bd958 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1834,7 +1834,7 @@ 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; + nr_failed += rc + astats.nr_thp_split; /* * Fall back to migrate all failed folios one by one synchronously. All * failed folios except split THPs will be retried, so their failure