Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp770995pxb; Fri, 22 Apr 2022 10:47:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmv0LunWNVIM8Q25zZOTgQHPV+feuaSbfjUwkIDGVCVhiATKwftV/kkB7GvcJEYM5qYD6i X-Received: by 2002:a65:6a97:0:b0:398:ae2:d207 with SMTP id q23-20020a656a97000000b003980ae2d207mr4789511pgu.197.1650649655991; Fri, 22 Apr 2022 10:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650649655; cv=none; d=google.com; s=arc-20160816; b=iiYGTyP869c67N5rdfzqrXWgdsQ86+XIFzfqbCi/L0UxD5m2Ae5YaMqBFZPFk6gDc0 NA8C2481D+SO5hozjwOpoEVv1zDD5DOin9PiR2RPturjCrTaI1uL0KDhkO/xQLQQUHhL /JNE6X6I2yR8cKChjAH2C6plvZNbU9LrCnayw4wHiJUBfsrMv7gsxESg1Ca2GiS57Mh/ BHpmjRWb16eabSj8j+nVL3JHezteMlE/uGDouJr2tij2WlkGTvCmdxRJwOFj5MlK3LN9 a3x5HH+rLJum+CW4XSOZSoYCf83QJo0NteGnYyTx0vMSwZH0eszpYN/tIiKk8HIRcClP mKSw== 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=Mw67xsmvgJm3wDok9ZOX/8hZNmQAUcIenetBIRy4A0g=; b=wWl9US21jPBTaFffU74f515tzJzQcUrdxLD6tXnsGutRYb9+kHhi5LFB6ZYu80IUWb HlUyXl2nnbd5tOnMlTDmfOiECq7fQv0ahWgkwkHRYwveLybMyHGnn6aDYmcHMw/9R7no PIZhPMEguRL+qbEQDi5rkNVRC0EGw2ZynCwVlxCtvV4KFx9hOcpic1qG6UU8vl3Zdysi EajhmQIPxvmSvtRDLxF0+hN719EraDgq3AS7zuF8vluhRMKJwUK/cxergT+129Ur7voJ PJlSrVhp6BHQFFmgx2aeZjMPvMLpU7uqLnhDt08iw2UoeQytiuyvjbzqJJFTdrRJ4bwu dAcQ== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k3-20020a170902ce0300b00158f7a7d59asi8340510plg.78.2022.04.22.10.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD46AF698C; Fri, 22 Apr 2022 10:33:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386361AbiDUIFC (ORCPT + 99 others); Thu, 21 Apr 2022 04:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383377AbiDUIE5 (ORCPT ); Thu, 21 Apr 2022 04:04:57 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B0891A811 for ; Thu, 21 Apr 2022 01:02:08 -0700 (PDT) Received: from kwepemi100003.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KkVLb0GvNzFqWr; Thu, 21 Apr 2022 15:59:35 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi100003.china.huawei.com (7.221.188.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Apr 2022 16:02:06 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Apr 2022 16:02:05 +0800 From: Tong Tiangen To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Pasha Tatashin , Anshuman Khandual , Andrew Morton , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou CC: , , , , Tong Tiangen , Kefeng Wang , Guohanjun Subject: [PATCH -next v5 1/5] mm: page_table_check: using PxD_SIZE instead of PxD_PAGE_SIZE Date: Thu, 21 Apr 2022 08:20:38 +0000 Message-ID: <20220421082042.1167967-2-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421082042.1167967-1-tongtiangen@huawei.com> References: <20220421082042.1167967-1-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 Macro PUD_SIZE/PMD_SIZE is more general in various architectures. Using PUD_SIZE/PMD_SIZE instead of PUD_PAGE_SIZE/PMD_PAGE_SIZE can better support page table check in architectures other than x86 and it is no functional impact on x86. Suggested-by: Anshuman Khandual Signed-off-by: Tong Tiangen --- mm/page_table_check.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 2458281bff89..eb0d0b71cdf6 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -177,7 +177,7 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, if (pmd_user_accessible_page(pmd)) { page_table_check_clear(mm, addr, pmd_pfn(pmd), - PMD_PAGE_SIZE >> PAGE_SHIFT); + PMD_SIZE >> PAGE_SHIFT); } } EXPORT_SYMBOL(__page_table_check_pmd_clear); @@ -190,7 +190,7 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, if (pud_user_accessible_page(pud)) { page_table_check_clear(mm, addr, pud_pfn(pud), - PUD_PAGE_SIZE >> PAGE_SHIFT); + PUD_SIZE >> PAGE_SHIFT); } } EXPORT_SYMBOL(__page_table_check_pud_clear); @@ -219,7 +219,7 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, __page_table_check_pmd_clear(mm, addr, *pmdp); if (pmd_user_accessible_page(pmd)) { page_table_check_set(mm, addr, pmd_pfn(pmd), - PMD_PAGE_SIZE >> PAGE_SHIFT, + PMD_SIZE >> PAGE_SHIFT, pmd_write(pmd)); } } @@ -234,7 +234,7 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, __page_table_check_pud_clear(mm, addr, *pudp); if (pud_user_accessible_page(pud)) { page_table_check_set(mm, addr, pud_pfn(pud), - PUD_PAGE_SIZE >> PAGE_SHIFT, + PUD_SIZE >> PAGE_SHIFT, pud_write(pud)); } } -- 2.25.1