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 1F07FC021B2 for ; Mon, 24 Feb 2025 01:27:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3F92280003; Sun, 23 Feb 2025 20:27:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AEFB8280001; Sun, 23 Feb 2025 20:27:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DF5A280003; Sun, 23 Feb 2025 20:27:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 83060280001 for ; Sun, 23 Feb 2025 20:27:46 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3C8984B9A4 for ; Mon, 24 Feb 2025 01:27:46 +0000 (UTC) X-FDA: 83153101332.10.9475A2E Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf05.hostedemail.com (Postfix) with ESMTP id 8237E100006 for ; Mon, 24 Feb 2025 01:27:43 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740360464; 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; bh=5kEA/ayi1ma1K7nCmp6/aV6/Spr62KtBQhZCVYXiHDI=; b=WuNNWCiFP2amycR8wGVsS0k7/QTtIVt1Wo4FxXnfEoA9PKLwxnEFoni6FwPIdJ/6YyBEwz SycPkQBDVvHm9vDk22EVw9Chu7nkMi6mHzaeFPdiaQzYw1ZcnrFEdvt6oqK0nkSvzyp9AC oM0qD9JWgEyiVr2+oM/iGLsu9Q0WX24= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740360464; a=rsa-sha256; cv=none; b=WAQLq1NxQHDHnYRox/LPyZYtlHmI/umlcubmb06NGWLIQujLEIV7H5jk/hLhOp+SoOWGph lsfctGRwTfopFQ5egDnfGXiRBl3AlQUAvhebl7cOGgazh1cfBnyeITGoncXAeiY76o0Kzt jSxVEBWm1JjTmnZ76IOZGkt55PWdpbM= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Z1NKl0lMDzHyyC; Mon, 24 Feb 2025 09:23:39 +0800 (CST) Received: from kwepemg100017.china.huawei.com (unknown [7.202.181.58]) by mail.maildlp.com (Postfix) with ESMTPS id 5791F14034E; Mon, 24 Feb 2025 09:27:40 +0800 (CST) Received: from [10.174.178.114] (10.174.178.114) by kwepemg100017.china.huawei.com (7.202.181.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 24 Feb 2025 09:27:39 +0800 Message-ID: <61566a74-04aa-44f1-9aa9-624644f06450@huawei.com> Date: Mon, 24 Feb 2025 09:27:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird CC: , , , , , , , , , , Subject: Re: [PATCH] mm: swap: Avoid infinite loop if no valid swap entry found during do_swap_page To: <21cnbao@gmail.com>, References: <20250222024617.2790609-1-mawupeng1@huawei.com> <2c7dfa44-266a-4aa6-9401-7528368f171e@huawei.com> From: mawupeng In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.114] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemg100017.china.huawei.com (7.202.181.58) X-Rspam-User: X-Stat-Signature: z3cn6i45ux6duuf8w6rk4mh51w1r3gxt X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8237E100006 X-HE-Tag: 1740360463-413509 X-HE-Meta: U2FsdGVkX1+MMMqGcB8Tt1jU6+fpCaWVjczRFd3jP0CL4cJveF4cNyfSb/42QAo9W6VY0r8uz4q+w5dEkiM8prqLBbJ7r7i6kxEVrQClT6k27LaGVK8PaUlM2Bzd4nYz4BhRHHBB3VrzaJpSlYNb4JTF2uc4RWAA3ctsELk49IV4FOYgJ5KDnFL4pOh0PnbJFX8gE9EfD+YptCcgRzjshIID4mreH9Anj3S306+a9IDElKZg2Qz74g/ccFsoN+sBeGfcUAEA0WB/S6JhFZpO5S3ofSot/PJN0gzA/8EDHCRu/wg/aKXpSPsMqCihfDtbOKQlW6YW/7LaLmT2yJr7sFu8aTVpd1WuJ6lq7alQWdiHa6unNz0SVfFc7HyejDU3QHWWskOokXRpKxtxVf41y+ub184ac2uky+3bX0G5x/NsPT0PHYEMSwfQ0XK6x4Fstj3rjaM+xAFnTHYRTepCtgAbtrkwjTFUHKgAiu0wXQ0KvRLoJA5jxmeqlmsM7zavCJnBNomq0EbdzcUW0NogekDZ9XECYcFV7GmBENfldytTu968LgRaMvWFxzLDd3pbdeqcMrDbhPuHy1PsVDlWlQaU5/iCdhjo6wbErYdqddZ+lc5uPLZ6Yf1uG7zi/28S+GRAtcpqdZit0Wj15SvReoe5v1/MUGXXa9GKu3bnXA2uKkZ0gHQZi3+/U2YsDfPF9YxbksvjkoTA7ty0TgiP9ByPOJd/RsLrK+qxOHo8nP/RWtYQt4U8g7JOYIQgRWD26ucUyh7yja5P2UxGFDJzOEzOIh95zV0qIC4G0O61oeU+rA0GtoCqVhl64PNqfxZzZp1C0XGMPJqk1vt2OvDMmBhlcKtO6YBCe7eqLvhgAEcSXi770cD7fmbc6dY7f/UDDa+mvV7sn6JfHAufjy4x1EWbCL86caPzv921pr5f7hOv7FpniTx1I8HsbGNJG/wZ1pvrXf8VUTNqi/74H6j ZszuX1do 7/KApCqM+3t7UPsllopB7/azUvRyGNo0j/xWmwKu6sRA4nUVArwZeCiaYQ3aYmaGxydCkti1nbGX0PR/GV6pINZTlZZoy+lSznbC5YhtIPfNMoD0duJFeMrUm26ZxLytLr0QwqjkGVWVNJLGeitU+Wz7MZPCgArGDVkaahL9zSLwKzT8hgmoDUQJrF7xWX8+QesHjAOau9Iz+AeRj2hlgHZKPnhPwDi1+6PT2KobEjc0fyBBDHmueYk7s7NeYytfqSEA0q3nL9iR5D+5dR8XLuiLmb+8axMDENIZwyj40eJF5QsShnLJqVFY8g3d3aFPWt9NhsZywcmZptL6BHj1R+m8tXuTVsCXqr0JDPOPHhY8afHLswewwrechpw1P3IrpdpzlzvD36Ro2F56MDoSfEsPjvhudBMJx7ujnpxrTgsbxvYyiwYvZLecSGf/VYTpPSkaUeAk6LsKQ/yw= 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 2025/2/23 14:18, Barry Song wrote: > On Sun, Feb 23, 2025 at 3:42 PM Matthew Wilcox wrote: >> >> On Sat, Feb 22, 2025 at 11:59:53AM +0800, mawupeng wrote: >>> >>> >>> On 2025/2/22 11:45, Matthew Wilcox wrote: >>>> On Sat, Feb 22, 2025 at 10:46:17AM +0800, Wupeng Ma wrote: >>>>> Digging into the source, we found that the swap entry is invalid due to >>>>> unknown reason, and this lead to invalid swap_info_struct. Excessive log >>>>> printing can fill up the prioritized log space, leading to the purging of >>>>> originally valid logs and hindering problem troubleshooting. To make this >>>>> more robust, kill this task. >>>> >>>> this seems like a very bad way to fix this problem >>> >>> Sure, It's a bad way to fix this. Just a proper way to make it more robust? >>> Since it will produce lots of invalid and same log? >> >> We have a mechanism to prevent flooding the log: . >> If you grep for 'ratelimit' in include, you'll see a number of >> convenience functions exist; not sure whether you'll need to use the raw >> ratelilmit stuff, or if you can just use one of the prepared ones. >> > > IMHO, I really don’t think log flooding is the issue here; rather, we’re dealing > with an endless page fault. For servers, that might mean server is unresponsive > , for phones, they could be quickly running out of battery. Yes, log flooding is not the main issue here, endless #PF is rather a more serious problem. > > It’s certainly better to identify the root cause, but it could be due > to a bit-flip in > DDR or memory corruption in the page table. Until we can properly fix it, the > patch seems somewhat reasonable—the wrong application gets killed, it at > least has a chance to be restarted by systemd, Android init, etc. A PTE pointing > to a non-existent swap file and never being enabled clearly indicates something > has gone seriously wrong - either a hardware issue or a kernel bug. > At the very least, it warrants a WARN_ON_ONCE(), even after we identify and fix > the root cause, as it still enhances the system's robustness. > > Gaoxu will certainly encounter the same problem if do_swap_page() executes > earlier than swap_duplicate() where the PTE points to a non-existent swap > file [1]. That means the phone will heat up quickly. > > [1] https://lore.kernel.org/linux-mm/e223b0e6ba2f4924984b1917cc717bd5@honor.com/ > > Thanks > Barry