From mboxrd@z Thu Jan 1 00:00:00 1970 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 9B20EC2BA1A for ; Mon, 17 Jun 2024 19:25:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FA0C6B0274; Mon, 17 Jun 2024 15:25:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A94D6B0275; Mon, 17 Jun 2024 15:25:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB2946B0277; Mon, 17 Jun 2024 15:25:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CD0526B0274 for ; Mon, 17 Jun 2024 15:25:28 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 76135121507 for ; Mon, 17 Jun 2024 19:25:28 +0000 (UTC) X-FDA: 82241359536.13.339BC48 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf24.hostedemail.com (Postfix) with ESMTP id 2854C180013 for ; Mon, 17 Jun 2024 19:25:25 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gUWcS4Qc; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718652323; a=rsa-sha256; cv=none; b=4Xqqxswf3xBe/jZe6q4KGPqSQ5Z0BDFjqF+7W46M7i6uvsABL57EEoyZc0Gxa84suTi0Wt nSbt7E8VOq34Xzq+a3xbaC1qQQ2vs+IFAWcc6CZBzIyxXXPruWJvkV6OMWCxDDrPgBuUZx vSrSjiqwQii5ozdrnevBk2FCkWJbMuc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gUWcS4Qc; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718652323; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ojk+RpoUvF1AIPU8r5JjmHDVFpTMAFpR0UDgZl8Hmdw=; b=5BlETSNrEdE+V6wJpKySrX3cPOCVgrwXAbdWbtbZCeBT/Tj3u2iO8NjAsvA19hMQaJYgzX NXu0yB7YypIoUjTrlYZWpjjApCf9KsJzMHV3HniAixtuNGHyJDnB53u3gpiSIdmkJYShzY ruWZ1eWMtzaOQ18OqR4YpQk3nhUT9kQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 629C1CE126C; Mon, 17 Jun 2024 19:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CB35C2BD10; Mon, 17 Jun 2024 19:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1718652321; bh=sneyNZ3rIjja01nckCQOaxoYSOD6aQqqx/eb4T0DPCs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gUWcS4Qc23q1OZNn9em+My4IYLYm4ZNGyuCovY+L6JGUhKvnhWBEvEUi0bcdpciJV RSC0d3zZFSoBNIrmeFWtT270HPdYIQnXx+ONeGteWMJj0tarZK4Z8h9Ak0F3wnjs4J vHqUp9JtINePNnfYdii0jxEvJuWgDb2E2BqXi5YQ= Date: Mon, 17 Jun 2024 12:25:20 -0700 From: Andrew Morton To: Zi Yan Cc: Zi Yan , Hugh Dickins , "Huang, Ying" , linux-mm@kvack.org, oe-lkp@lists.linux.dev, lkp@intel.com, kernel test robot , "Matthew Wilcox (Oracle)" , Yang Shi , David Hildenbrand , Yin Fengwei , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/migrate: fix BUG_ON in migrate_misplaced_folio() and compact_zone() Message-Id: <20240617122520.6b4ed2cfc6b09d6c739c6c8a@linux-foundation.org> In-Reply-To: <20240617143926.1511227-1-zi.yan@sent.com> References: <20240617143926.1511227-1-zi.yan@sent.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: s5y4fhosfn1rxyo3dym8j8n1ye1kptoh X-Rspamd-Queue-Id: 2854C180013 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718652325-735916 X-HE-Meta: U2FsdGVkX18ERAkI+m242DJ0KPZmbPRdGaLPR9F/Q0OQyjqEAK1W8kO9yzD1ilCYhmmAhni6oIF75iDjw+i5zDQQd0vYpr4EYRAAMe14Brl1UCp11jX7uHWq/9Um/TjdWlcbM37vazy9v5xCDKrcchDGsyunca7YV+dAMj2J5iu1KEqqmgIPkBTYBDbXFvNuuftr6Uydu6/Ne085NnAI2tSu7N0S6TAN5mgDN0w61chNGZWXMsqNzyDFMDP7DA4VkvpsafJuuyXJsJfvDZKfP2mKK69zqX2pyYsLi261IrUCNmme0ianYq9YKak6Ctv77xOkEbyD1FunehAo2SbJ9TEdJS3//mlaDhe+gTs3EU/36JhghY3lyr/PCjjVv2rb4urrPwsWyOkweBkr8XW6VurP16SmdW6MyO1FgVWrJYMo7RMHktkqMSrEfrcO94eoqtQ9s/Sz1RhWJj4gMBdsut5iGbOf/beeWuH7WWn/WuxP1w8Lx/UAw1wLaOAZ0oxUjyHDsRluzdA98O3XSYOFg8wmoxXs7atuUPDcbqO6TOXqu972BBr/Eshth9yFkPphq7ADdGdXJSZzMeOvWYYP484FcEAjIOi/WYvc0wSs/YRi6ceIB8wv4+zrANsmgMywx9XqLG0cdVBll7O3Zk18Y74gOv3QrMoyW77RjtrXqH3GDYu0m5vtM3wUxkrD/LLtpLcEm32mSrSx7t6Jx+kTf6WbEcF/3Br5Vfu7jDUoxV0VcP0IncBqKy38ZtzSqQf2zmCbOXjJc9ARDJWxWV484xOQJZfQtWfIkxorWj8/ZzbJNTYzIjIJkPRcUTKL3Rj4MlMs5VQiYzEBooMG3NwIu1pQ9vbk/kx7+S+U4dZuNuOxqVkf4q23iBPOLtXZdkZaygm+k1o6e5LG+LcwvcmvrZ4NoWZkNJBTjDhjbEoh0R8okcBGnoLFAI6Vn8CTBlrpET55xfk18avd+xgLj/h xeEL8hL5 5C1fkn8i6X5V3qdQFaqCDMsIe8YN64InXSfGYbVPonXW3HT7I6uo8iQIekV2iKGo98R55MmlrXxV37SToXVbAviG9Gd7VgZxsbBU73UrrTbHQK6hI0xDx7JMk3g2hEeIco5gqAFNspx33SeLMkkEsNEH3agtQMp69nvWJHLK4JY2RmGuI86W+fRfjTRARroLY4EL6G2LjdJ6DA0YvNXMEePZCCaKEZ1Zv6CKlZNlOxYIH1OSuLHokPCWTeLEZapv3k0oy6MVyYm+T/Qik0HLQd0NfmOSHhoHw1jKxCz5nTuRBYxujq5UsIro6mPvjx07pjLJT4K8+utFDoYxhTM3GXJoX5OYdGs00HjFA 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: On Mon, 17 Jun 2024 10:39:25 -0400 Zi Yan wrote: > From: Zi Yan > > Both Hugh Dickins and kernel test bot hit an issue that migrate_pages() > reports success but still leaves unmigrated pages on from list. It > triggers BUG_ON in migrate_misplaced_folio() and compact_zone(). > > Our convention is that if migrate_pages() reports complete success (0), > then the migratepages list will be empty; but if it reports an error or > some pages remaining, then its caller must putback_movable_pages(). > > There's a new case in which migrate_pages() has been reporting complete > success, but returning with pages left on the migratepages list: when > migrate_pages_batch() successfully split a folio on the deferred list, > but then the "Failure isn't counted" call does not dispose of them all. > > Since that block is expecting the large folio to have been counted as 1 > failure already, and since the return code is later adjusted to success > whenever the returned list is found empty, the simple way to fix this > safely is to count splitting the deferred folio as "a failure". > > This patch is based on Hugh's fix and suggestions from Huang, Ying. > I have just sent Hugh's version in to Linus. So if/when that is merged, please send along any needed updates.