From patchwork Sat Jul 15 03:17:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13314368 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 6766BEB64DC for ; Sat, 15 Jul 2023 03:17:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF5758D0002; Fri, 14 Jul 2023 23:17:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA6CA6B0078; Fri, 14 Jul 2023 23:17:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A34CF8D0002; Fri, 14 Jul 2023 23:17:28 -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 8A7366B0075 for ; Fri, 14 Jul 2023 23:17:28 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5BF46160435 for ; Sat, 15 Jul 2023 03:17:28 +0000 (UTC) X-FDA: 81012385776.09.F7592CA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id 0D8A4C0013 for ; Sat, 15 Jul 2023 03:17:25 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689391046; a=rsa-sha256; cv=none; b=HarPJnLIxcpuN0nX3YYgA4O5kwycznS4AgzMOBfwyCE00Lh4PAF8UHgw43Zjt3yacTncqJ soIKQlfimCujo4t5bEyFP9uPKBUbT9ZP4M5BH3jS86KWtg/msalxmTJU7cyV3tcE5D68W0 BLUOuFFKhrS3+wsBqcXL009UbGNreTM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 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=1689391046; 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=6SR4RM1lW66uhlnv83Prq7cpa/zrVS70ssAIFcoXwIs=; b=EdyDo/kiobt1VwNMEdPvsu1mHVytpLPouIwf7/xVkWr9lil9Kbos/0Cp5YKRV1v7XQXCOp SHVwjWmXeCT/WB5d6wmVwbftZI0qKjpvObG08pHJxtIsEru4RlVVaQrcW0Nr1a+txRM/+X fFALsRtYdwtOi/nMyQuErAzHHm2Eix0= Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R2tjl2GlmztRMF; Sat, 15 Jul 2023 11:14:19 +0800 (CST) Received: from huawei.com (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 15 Jul 2023 11:17:21 +0800 From: Miaohe Lin To: , CC: , , , Subject: [PATCH 4/4] mm: memory-failure: add PageOffline() check Date: Sat, 15 Jul 2023 11:17:29 +0800 Message-ID: <20230715031729.2420338-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230715031729.2420338-1-linmiaohe@huawei.com> References: <20230715031729.2420338-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0D8A4C0013 X-Stat-Signature: gpjd8uzris37uw1z4q5k11qwzobw6ei9 X-Rspam-User: X-HE-Tag: 1689391045-973979 X-HE-Meta: U2FsdGVkX18Gm+ZJzMMaZLfZEKilfQQBwlnVjPrFa3g5tbipJ6+u/mYxgp4j6XZI9jUY6Q30TEdRGTkjjwsezkbyastP5aXtJQWVltF4Q0Ie/Jd8XlDxBz3qMzgdaDnp7JIMRZlWjyGarJ8k8UZDUrWUW3Bx3lMI6KexHVjl+Ek/htdpmCscC0LrB9PWIyIlJkv2eqKBShWDb2twZ9ySI7QfEMQecBkhYSPMX2pu+ApdCuAtVNSalNZELBwGpUIiRHfM9ELOUvRAqkbGAL/LNBOQslFm0/7Q0IlVGkJ5eyI5kmgIE4wqfzlAxcYydyrCs9sqVPn/gseEc7nuXzgQHipI4W33ujN6nBzcmJswMEZneLYJmaByGC6Q9VI75Nid3CxE3YF5dI0qfyMTrgdfgIMMCp/YB+ncJjeNSorX3oDMZ7/mestzCc2xUAS97eg3d5WjrHJtaGam/Sy1xH8+Ft057/CY3KRxysEnCFAowr72yvOQttUD/bLYkL/RGqSLKmqQS9JWhjzXVs9wjmo5q59q5g6Xie8cnx/A31VDCJ82BFOkH1bReeJhZ/CnHU2eA8faGrO7DJnUcicLlOazQDqRXwXtMCmcoeEV8j54FtRdqKgrNHYdkC09rZyq5ClAGv8DN/zegqhnIqF+ZhdlitDUN/0RXwJEzuVYw4vm5DGRYlmynN/ifwPhm9uKwqT9LzzSqFjTOzddHZS5PYoZ2/VGfteMeulP6iTVZ4wD7xddWlLc9IfBfAQKECqb1JM9IC9yjW5z/eTjmvgqx1AHBcuDfhUr+n/bzvi5be4WNQWP9abxGrSy/t5IIxo8qOoCTdePotIK8JDiKgl4veDwWT2fvRuiFvIAzub2a2uiZAEKZjXyFay9+u5C/enS9y5O6TaNGKRh6dN3HEmJnqbSIb9+yCHfrROgIGOaDFI5g9eyWgslr9Kox2EFyb2DFx4szRKsnSvrs6kmeWC1p7F no0N+ibV v9bVFAK9QXVyISx4kdjWgRH10riQBg92TESWoP1pgHVK5IEOLj5T6TNLwWSAC1fWp3kSZMlU6wpAdnG+8hHbpz7Vea5FSmGr0+R0ki23RatVd234cUluOq5ES/BDF/ToLfda+JmHC1BG4rpM= 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: Memory failure is not interested in logically offlined page. Skip this type of pages. Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 42e63b0ab5f7..ed79b69837de 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1559,7 +1559,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, * Here we are interested only in user-mapped pages, so skip any * other types of pages. */ - if (PageReserved(p) || PageSlab(p) || PageTable(p)) + if (PageReserved(p) || PageSlab(p) || PageTable(p) || PageOffline(p)) return true; if (!(PageLRU(hpage) || PageHuge(p))) return true; @@ -2513,7 +2513,8 @@ int unpoison_memory(unsigned long pfn) goto unlock_mutex; } - if (folio_test_slab(folio) || PageTable(&folio->page) || folio_test_reserved(folio)) + if (folio_test_slab(folio) || PageTable(&folio->page) || + folio_test_reserved(folio) || PageOffline(&folio->page)) goto unlock_mutex; /*