From patchwork Sat Jul 8 08:57:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13305629 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 7D8C6EB64DA for ; Sat, 8 Jul 2023 08:57:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DCCC8D0001; Sat, 8 Jul 2023 04:57:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5660A6B0072; Sat, 8 Jul 2023 04:57:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 406FB8D0001; Sat, 8 Jul 2023 04:57:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2C8DF6B0071 for ; Sat, 8 Jul 2023 04:57:37 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E2A7016012C for ; Sat, 8 Jul 2023 08:57:36 +0000 (UTC) X-FDA: 80987841312.04.6D505D3 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf20.hostedemail.com (Postfix) with ESMTP id 5030B1C0013 for ; Sat, 8 Jul 2023 08:57:33 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.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=1688806655; a=rsa-sha256; cv=none; b=siqyqEQqcZcu+EoB6yg/PvLeK5wfKJfieQ8mYyUCAufPwwmOPbALIsrDRSfciRXd2rKcms JBd9c1irQqaOeT6KxWeg6iWHnqy1Z5wftCpwtK4A0kAI4VNHrWqlagDEy1KnIR7Dk3+ODl t+TJLJgyG0QgftCTwIjyXN3jJnO0lyE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.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=1688806655; 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=nu0T+4OifjpWSZTiUfF2QlfBWJeikYeHAbyQgFEM6So=; b=mv0p25NPMsxr2dozWyuW51qpAA1Z2g+oBtpSrTn/gW+T088g09TbF2SBNFuO4JdvHstlYf WJMJ9zNXNNcxy7ayaHzE7mZGq4Bnl2zrCwh+KHkWNQXY/GwtV0n+LAb6dpM9L+pxWlChOh XDn08BOPWDChaswFh7jMcJnSDXC97pw= Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QykbZ0mThztQRv; Sat, 8 Jul 2023 16:54:34 +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, 8 Jul 2023 16:57:28 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 1/8] mm: memory-failure: fix potential permanently locked hpage Date: Sat, 8 Jul 2023 16:57:37 +0800 Message-ID: <20230708085744.3599311-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230708085744.3599311-1-linmiaohe@huawei.com> References: <20230708085744.3599311-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5030B1C0013 X-Stat-Signature: kwqksmczhj497qmq69wsfu7i6tm4c7wk X-Rspam-User: X-HE-Tag: 1688806653-890382 X-HE-Meta: U2FsdGVkX1/YRsH8Ub1QVWKQ+aq5EuyeOIU+Hvpo/xHyFvxsq0CfjyhHbooy8wu+yWinnPwggG4eQCM5qpg49BI48jPFpdHzMbnYTrzSZSWo6BgDvXIL52onxuou1Ceel4ZkN4N5bFZaD2FW8nEPtXlX2idSMp1SLnFYRWHwlv2+sYVFB2HqO/XVy2QpVBDB0EA/wGChjgWMDPmwuf13x8xFC6NEAR6nxzs//TNpX577x13Xd/D4n4azWHbpSpb0YUNDQzidRdVTipmPicg53+qYsaSdEacSQ/6VjG/R8AOoiI8+YlaHGX/cLZZ28k1gevzEEVb1fj5UpJpVWbxI835rueZiYDYeI/S+rx7kRbnKENHmrOUNgGTkPPkEIanzoEC/fUB2UkaObfdOUz6hbDi06TjBsEkJ5k8Xvvc8j4DVIaNq2uNEjTJsNK4osoCUwu5v89C0Igs5Epwhci/QyNu1iba0M0eE31EXH0FRi1gMqiTAEWQGca/wrvB2uXhJqCmA/ZnOW2Z+/t2oUHWQIoIXB6IiOU67nNF3wsvAJN2HT5kI63vw8Hzlx8nCZEafefshGVlaZAXUPCaw+j1v3BwZRc/AqoEhF2PCv5eB6bK2d0tW0/HmsPfRuDc0lemE2PlBw5GspX9Js4Z8JVHQUFcnBwdd5yzH0Npp/FizPMWDCgzXWEEpYLeAr90E2Eg4L/mRHOGSvFaXwrth0M9RtqCmRO/YZJbol7xZFicVgTOVgawHKj7RvIMrACf8VvxO8hhSBOrilXhYa01iwsF0cn7ut8ynzMDzE1I7sNxt5pvfv2e4QtG+pP/Y3hVBkVuMJXLP6OV1BjRQMRIshKcPAOhF1Wm48PCqeAO9CHEicVu9PRGVaHYUJOVr8NFZ/bes5bA/jGjjNXrUg9J4/u5Qn1eJtXIQVEg6ybmFBM+aXKAlYI3ThSCUPFHDuo7C3NiVMzPzjVOboPnnDABdUPY PqYRy6MW B0b+P8NWSq6f5jkZmyBCW10kvoV0HafWFEZKL06lJBWkRySWRx/P+lpUg0g7q9gX0KK/Ahy/xRZxAE4wTnuH1G94mtOR/+xekG/ZJNi/L3e1m+HUpXoHKIrwlYgoclhLyfOvwzbjc34XZMtlI8E3fH9z+8UnwvFzgcPaRPUEM3tvUls8= 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: If hpage isn't Hugetlb page, MF_DELAYED is returned without unlock hpage leading to hpage permanently locked. But this shouldn't trigger in the real world because this PageHuge() check is just for potential problems. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index a6221a4bc5ea..d21ee27ad412 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1187,8 +1187,10 @@ static int me_huge_page(struct page_state *ps, struct page *p) struct address_space *mapping; bool extra_pins = false; - if (!PageHuge(hpage)) + if (!PageHuge(hpage)) { + unlock_page(hpage); return MF_DELAYED; + } mapping = page_mapping(hpage); if (mapping) {