Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2126175rdb; Mon, 9 Oct 2023 13:33:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPEksTu90N1//m4stgegWnxJWC03UyYo9uU1radAIaB3MBvJGw7M6FDCNKp4L2P8Im77UA X-Received: by 2002:a17:902:6f02:b0:1b5:561a:5c9a with SMTP id w2-20020a1709026f0200b001b5561a5c9amr10401614plk.39.1696883588818; Mon, 09 Oct 2023 13:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696883588; cv=none; d=google.com; s=arc-20160816; b=PgRtGSsGeaTx0h/bO1TFT0tk6W5AsvQ15F9ijpCucyhxuq9IIMttUKRFBY9RsKdCIe B1IqVO1Q0LxdtDzd/k4Mf27fyZvqJ3RIqTwlKMP2r+feYLSBXQLw4ILe1ukp3blLENI0 mFxPNYXj+E1ZfzGJEaw7ummDOGE9PI5L07mZfeSafsNTQfldj9nJK76I+BFrH+My4ktE ZGBdKOEeS3ajFTNPgLEadDgd+h3BnuJu9rRQLAZb07xCxxBbA8ZXt5GB557o6QvZ72Wr wes8GNfqCf2xumeH88UsLYl3qC2Ed9d4TZ9A0ADEtVUt6UGLa1cwJq9US/V1jMOwIKHT H/Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:reply-to :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=SzCcXEw24lbVQoLDSre4+93FDqVAU/sVIvBTCkxblE4=; fh=cCnZvojZaURT8jH5vmOig0nNKc285jQ0d11KMSgr4+U=; b=GIWoedXyiAy+bs7MzoNUXNN4keZ9jnT2gWvsJG36nq/U7xZvGbDt9ihppnbq0c6r2h Xy386oFwn3+9Y/xFvT9+1LF2RjMNm2lP1BMdvKw3IL0uLIAyczMM7we8zTO7k/3sWuWg udymVrCJZUB2Hteig+TxSBvgTeTAmJfKwUP1tTSQfDv45bZ2vcQxuD+dTa4qhLwp1r2t ug5rfcur7QCGFUfWrD1H/jyUIHivrnFC1PfdbVNtQIUiecNCNki4mTmbt3l75sY+YBsn vightrdWFQ7GM+X42+4dIKlsUJLpb0C/kXFTbTZvEtiih4/tCgCtSvI908AXN8956EIn qeeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b="HO/OHuE6"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=cxlJl5XS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id jw17-20020a170903279100b001c624cbc92dsi6713703plb.296.2023.10.09.13.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 13:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm2 header.b="HO/OHuE6"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=cxlJl5XS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 197C280330DF; Mon, 9 Oct 2023 13:33:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377876AbjJIUcs (ORCPT + 99 others); Mon, 9 Oct 2023 16:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377354AbjJIUcq (ORCPT ); Mon, 9 Oct 2023 16:32:46 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21B2A3 for ; Mon, 9 Oct 2023 13:32:44 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 13:33:06 -0700 (PDT) X-Spam-Level: ** 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 =3D 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 fi= rstly") 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 +=3D astats.nr_thp_split; - nr_failed +=3D astats.nr_thp_split; + nr_failed +=3D 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 --=20 2.42.0