Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4601904iog; Wed, 22 Jun 2022 02:03:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v4UbAxib6wqk7x5yRNaIHP1PlMU+0QzIfgvo2WUw7oFUbtBfjt6b0RFRLYW1tACjssPMs5 X-Received: by 2002:a17:902:f792:b0:168:e97b:3c05 with SMTP id q18-20020a170902f79200b00168e97b3c05mr32847054pln.94.1655888622541; Wed, 22 Jun 2022 02:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655888622; cv=none; d=google.com; s=arc-20160816; b=jFQ4rH8pRWwsTMWxCGaXTJJKtdgZKYE4pDzvma5sNWikg6hfOK9onDg0QrRvMNUvUc U/nkZMze0bA6zQ19LJIFHkrb3gQ43cbnOQXsTExS1WjrdhSGcK/lfsCZDFzUsogVJOAq XR9b28GtsDSrj91+QxLsDz/bS/lrbL+Dmf+/LSXXWeYJftsokJWrreBDiWQjeTET76SY R5ckMfCpcEC7eK+sfEaCd1UqUGkIdjSI0pbrGis2IMQPXS7mi2ngwipMYxFMY56jC57w d4+Qo4+jpHsriGZRYCqu96N4Bq//vsVZrKFlGy+eROz+ywe9NIU9hzXnM4YEe8RFU4/e KoGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=+Bx3uIJuo5c8XX9g/xjHfAOLt+V/VE1y1Gi3ypkwsM4=; b=mG+i6GcnTV2Va+dFEzqSlypAXl7NGXhK1CidwIwRs8OaBtKnK2NwJCjFxAZwLFUk84 B5xz02TWA3KkLyk5acDlZ/kP18DD7Zlk8CWtdnbIpILV9twXFm89W0qbOtTSWvr2P/r2 WldZFtOp3hVEt5woePVx68jdznkzUM4Roml3gyorYFPWNFVkBhjnvR+Pt3Y7jNiTVUiC t6oA/fJqXxUZx864o0t0k+Vf5pZsbmvYfjvmrq6CPyyZPjz8RD2OnUVmodeA7ruvn+sa +6TjrchXIi/THh43u7+qoNcLTVFmR3GBoktopWw0uXS8Yqx93JJi1VIBzJhTwApK9bBu qqHQ== 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o14-20020a635d4e000000b003c5e1870569si23808386pgm.171.2022.06.22.02.03.24; Wed, 22 Jun 2022 02:03:42 -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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356602AbiFVI7S (ORCPT + 99 others); Wed, 22 Jun 2022 04:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356378AbiFVI7I (ORCPT ); Wed, 22 Jun 2022 04:59:08 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF5D10AB for ; Wed, 22 Jun 2022 01:59:06 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VH5CzRp_1655888343; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VH5CzRp_1655888343) by smtp.aliyun-inc.com; Wed, 22 Jun 2022 16:59:03 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: rppt@linux.ibm.com, willy@infradead.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 0/3] Add PUD and kernel PTE level pagetable account Date: Wed, 22 Jun 2022 16:58:51 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 Hi, Now we will miss to account the PUD level pagetable and kernel PTE level pagetable, as well as missing to set the PG_table flags for these pagetable pages, which will get an inaccurate pagetable accounting, and miss PageTable() validation in some cases. So this patch set introduces 2 new helpers to help to account PUD and kernel PTE pagetable pages. Note there are still some architectures specific pagetable allocation that need to account the pagetable pages, which need more investigation and cleanup in future. Now I only send patches to mm mailist, and if no objections from mm people, then I will send to the related arch's maillist to get more review. Thanks. Changes from RFC v1: - Update some commit message. - Add missing pgtable_clear_and_dec() on X86 arch. - Use __free_page() to free pagetable which can avoid duplicated virt_to_page(). Baolin Wang (3): mm: Factor out the pagetable pages account into new helper function mm: Add PUD level pagetable account mm: Add kernel PTE level pagetable pages account arch/arm64/include/asm/tlb.h | 5 ++++- arch/csky/include/asm/pgalloc.h | 2 +- arch/loongarch/include/asm/pgalloc.h | 11 ++++++++--- arch/microblaze/mm/pgtable.c | 2 +- arch/mips/include/asm/pgalloc.h | 11 ++++++++--- arch/openrisc/mm/ioremap.c | 2 +- arch/s390/include/asm/tlb.h | 1 + arch/x86/mm/pgtable.c | 10 ++++++++-- include/asm-generic/pgalloc.h | 26 ++++++++++++++++++++++---- include/linux/mm.h | 24 ++++++++++++++++-------- 10 files changed, 70 insertions(+), 24 deletions(-) -- 1.8.3.1