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: 117419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3806998vqx; Sat, 8 Jul 2023 02:25:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrN8W9W46p4VF3N6K0L2y38E5qzf7eur+IbrDKH96E2j02bWdd3cYzFfn8YxpVwyy4XUcT X-Received: by 2002:a05:6a20:8402:b0:12b:40d3:aeb1 with SMTP id c2-20020a056a20840200b0012b40d3aeb1mr11736219pzd.25.1688808345960; Sat, 08 Jul 2023 02:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688808345; cv=none; d=google.com; s=arc-20160816; b=mHDP/1UiEML/7ZbnD8y4h8DaM9xn4T6Mn5Kz7uhtqH+Xp/OW+I/EViMUvAcR0Ezpud fQ0fSr9n8MjzTfAwyntcoSUpF/R93YgOaK/LZtVfUIS+BVYn9sAPfMzEkpD9H9D501aA ieXIok70uRl6mkKsd+kfMzptv3JEUaYHoMFe1eNN0nruYu7whJy7PD7oyY4Y73oKhAJm NmS3iL46Y8mZ7tVq/f5sv4KRhxlPZYdf5KTJoiG8PjeIzEQRn+4+/xK7oGOxwOCO1CHS 8sor5TKJnI1Hlj6gGwYLNc4W7DpQF96RD4xy1kgiVP+Wj1Rg64JLjVLhKaTvGKU2RiDk GrPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nu0T+4OifjpWSZTiUfF2QlfBWJeikYeHAbyQgFEM6So=; fh=4o7DIXI/66oHEW09L3854GeQKXh9nrvBy5ZxENMFBvA=; b=N7uxN/I5m2EaoZtn7pYj577Y4O6w3lzBmXqYHUPyHdhsZ9eTva3RDSPhE/WmnbcA29 auAqNDjMXYJRKrc7gw0omk2W1YnBpKFCyauMGJnH8eszAXUatMy/KzfvQ7znmgdHSKmX nYPuqDCc1NHwVzXXhoQXNrhNjkkYfWg60rdlziW2K7DJberJyVdQuBDS5Jqtt446nM7/ GN8CibU4zbl25bhKD3l+mPFXSrhamha6zqVFgB7qOLSx2AiLwgJ2lowwaDr6GdrUTDyw WXhi3sV3wbVzrwyPhMmfPK6SmvC5zWc3W1yGrmuH8EIINphmGYeokKR6Xu01mFUEYaBS KrYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n125-20020a632783000000b0055757030059si576365pgn.3.2023.07.08.02.25.32; Sat, 08 Jul 2023 02:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjGHI5f (ORCPT + 99 others); Sat, 8 Jul 2023 04:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjGHI5d (ORCPT ); Sat, 8 Jul 2023 04:57:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF1A51FEE for ; Sat, 8 Jul 2023 01:57:31 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770843899880177360?= X-GMAIL-MSGID: =?utf-8?q?1770843899880177360?= 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) {