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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29C63C433FE for ; Thu, 17 Nov 2022 07:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234250AbiKQHIz (ORCPT ); Thu, 17 Nov 2022 02:08:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238973AbiKQHIp (ORCPT ); Thu, 17 Nov 2022 02:08:45 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AF9F1DF1A for ; Wed, 16 Nov 2022 23:08:44 -0800 (PST) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NCWGM1754zHvyV; Thu, 17 Nov 2022 15:08:11 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 17 Nov 2022 15:08:26 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 17 Nov 2022 15:08:25 +0800 From: Liu Shixin To: Catalin Marinas , Will Deacon , Denys Vlasenko , Kefeng Wang , Anshuman Khandual , David Hildenbrand , Rafael Aquini , Pasha Tatashin CC: , , Liu Shixin Subject: [PATCH v2 0/2] arm64: fix two bug about page table check Date: Thu, 17 Nov 2022 15:56:00 +0800 Message-ID: <20221117075602.2904324-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Denys Vlasenko has reported two bug about page table check on arm64. On arm64, pmd_present() contains non-leaf pmd and invalid pmd too. When collapse hugepage, the pmd is non-leaf and should skip the check. Use pmd_leaf() instead of pmd_present(). When split hugepage, the pmd will be marked as invalid and then populate. So we should decrease file_map_count when invalid pmd and then increase when populate the pmd. Add pmd_valid() check. v1->v2: Update comment and optimize the code by moving p?d_valid() at first place suggested by Mark. Liu Shixin (2): arm64/mm: fix incorrect file_map_count for non-leaf pmd/pud arm64/mm: fix incorrect file_map_count for invalid pmd/pud arch/arm64/include/asm/pgtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1