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 8F44ACD1296 for ; Wed, 10 Apr 2024 08:16:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 164836B0089; Wed, 10 Apr 2024 04:16:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1148F6B008A; Wed, 10 Apr 2024 04:16:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1BA26B008C; Wed, 10 Apr 2024 04:16:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D45966B0089 for ; Wed, 10 Apr 2024 04:16:18 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0FC171406D2 for ; Wed, 10 Apr 2024 08:16:18 +0000 (UTC) X-FDA: 81992914836.11.AA2D681 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf16.hostedemail.com (Postfix) with ESMTP id 5BF68180007 for ; Wed, 10 Apr 2024 08:16:15 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712736976; 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=tbNa6uDOPQ03x7Nc4CIwVVVeqvYmRz/TNLiQGp5UX18=; b=0cK3L8cYJXSI+oZ7SOCJRAITtB/piuarCLXjq2aIC/vtKgu+APT4ZfTECiTC9CuoCPwMYt 5ch8E95459gJC6R1KyetAAJ/G/NXtOTmzEvJl1ibXGKt9q21XIfKiHCf6y3Kk6QUsPbxa8 h+WMmhmZ6ppiJutyq0nIJ2I5T2hqqmc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712736976; a=rsa-sha256; cv=none; b=ei/XopCeKCdlG7KUxAsEd+Qjeml8P6nHLG656OY3AEH12FIkDBIlCMuyFcEh5KUZfx1XFj FFBop3j388Lso0mQU5lXIg1GS4rnZCD2G2ZXG8ojOpEWbGgyfBAa6At4v4VVFtpX2qDobu jutZAH3xCakgZ7E/EuLbVk3aS7mAByg= Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VDwYq151qzWmjq; Wed, 10 Apr 2024 16:13:03 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 3EE1C14044F; Wed, 10 Apr 2024 16:16:11 +0800 (CST) Received: from [10.173.135.154] (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Apr 2024 16:16:10 +0800 Subject: Re: [PATCH] mm,swapops: Update check in is_pfn_swap_entry for hwpoison entries To: Oscar Salvador , Peter Xu CC: Andrew Morton , , , David Hildenbrand , , Tony Luck , Naoya Horiguchi References: <20240407130537.16977-1-osalvador@suse.de> From: Miaohe Lin Message-ID: <5b730a9c-440d-6527-a761-e15c9670af83@huawei.com> Date: Wed, 10 Apr 2024 16:16:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.135.154] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspamd-Queue-Id: 5BF68180007 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: kczjorw6k45zykmnuyc4dbh7r5tard3j X-HE-Tag: 1712736975-172414 X-HE-Meta: U2FsdGVkX1/047JpMfc+syMWRn2tEYImt8IUCFigWXaB4vnArN/1AnfHvCtG8EJYhg1BTqc6ocJ+qoAAJVqnstVl6uawMeWLAZB48pXriW7RI1U695FHCwro2xmBfZYSbQDzLo+K2gYXN8XGtdpfT9cqetBKZR2kNkrrudNR5Bv16jFgRhJfx8ktfIZAQUbYE1EYi6TocfU1tN/0/twDnTzo1BWfDIRlyv2H3nGp8aINuVHCUqFe43HqZ+HpUJi4+/9+qvqDCxh+UHXwOrSD+PVBg0NfeHPVuX7u6JRatMNXZYUVnt+AQHoVl82FNH68OU6mWS9mznR/br7kC+8yh9C1OTUcZcSarT7IZ/tbZ5uldw63QNzoB04r9drHMwBI54mna94CQHthiymsWhR9efCi+nOaNXJKxOUf5yd0gaSClP2Nvr2y2KiHsbI0vH99IDqSiuZ0nG/gw4kvv3jlkHLmdHsslWbDawaIsZVcI/tZDTW0471SPiBpImpr6kLj5q+Udth90M3oE8d8ZYZIjCOGN194xtAutzJrLpILDBfI9NATHjkVPxIKFacnYxSpzRFPBwMUxTI+/E/jnD0+VJZNZCaKVuP3X1ZcSy6NePn4CtJPm577DR6J0bH0qLcKaN0X6x5rcfRgvhy+jXtgB7FpuP3Vgc39KI60/7oo6X3NiiN6Jc5SasD1E+qrN885yTesSAIZqGO4wGw7HDR271Uv+HjjfohQHJpCNSSWqaI2oiDfM5BD8Eq97962aUTeF2q0zBSMMufEwuEC1hojBqHgjw3BZt+r2tI/k80L74Mr67JkLDaf4mkE4M91Vj8yBK5N39ADnDKVn2H+Sew0HoAWJ/FjxhV+q4pez9ua2SC2G/KHoQ9ZaQOKeWorpIenpQfjowt7G2OAHRHV6PxT7E0CVn6YfDGrCB3IY1mdXPmVESFW9NYtRnp2bfrnQ2PQPujLh4lBRremQSo1Laf vqPvmej7 lEj4MyA0In8p/1wP+dn5hb7pK/ps4ABAx72vmm3ESLGD1rCpKiZ+s0E1X98thz0uw5s3l3U4t/4UW79wV88/ISobu4p7nUKAMvHgQhCUiH5XoaYmcre2pk2wVcZLcl/WRyLtfRbcl50NZQ5dtTx4MaaYEZOLyqg1skYG/9hku2YLtFlHPeVlFGcfv8+3hmDFGW0uhOTpUS67Zu8Q= 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 2024/4/8 4:31, Oscar Salvador wrote: >> Totally unexpected, as this commit even removed hwpoison_entry_to_pfn(). >> Obviously even until now I assumed hwpoison is accounted as pfn swap entry >> but it's just missing.. >> >> Since this commit didn't really change is_pfn_swap_entry() itself, I was >> thinking maybe an older fix tag would apply, but then I noticed the old >> code indeed should work well even if hwpoison entry is missing. For >> example, it's a grey area on whether a hwpoisoned page should be accounted >> in smaps. So I think the Fixes tag is correct, and thanks for fixing this. >> >> Reviewed-by: Peter Xu > > Thanks Peter Thanks both. > >> Fedora stopped having DEBUG_VM for some time, but not sure about when it's >> still in the 6.1 trees. It looks like cc stable is still reasonable from >> that regard. > > Good to know, thanks for the info. > >> A side note is that when I'm looking at this, I went back and see why in >> some cases we need the pfn maintained for the poisoned, then I saw the only >> user is check_hwpoisoned_entry() who wants to do fast kills in some >> contexts and that includes a double check on the pfns in a poisoned entry. >> Then afaict this path is just too rarely used and buggy. > > Yes, unfortunately memory-failure code does not get exercised that much, > and so there might be subtly bugs lurking in there for quite some time. There're many memory-failure testcases but some code paths still didn't get exercised. That's a pity. :( > >> A few things we may need fixing, maybe someone in the loop would have time >> to have a look: >> >> - check_hwpoisoned_entry() >> - pte_none check is missing >> - all the rest swap types are missing (e.g., we want to kill the proc too >> if the page is during migration) Firstly, I thought rest swap types just won't exist in this code path. But after second thought, it seems it's possible. For example, when page is being isolated for migration, memory_failure will fails to isolate it. And the second MCE event will goes to kill_accessing_process() and see a migrate swap entry. >> - check_hwpoisoned_pmd_entry() >> - need similar care like above (pmd_none is covered not others) > > I will have a look and see what needs fixing, thanks for bringing it up. Thanks for your time. . > >