From patchwork Sat Jun 4 01:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 12869518 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 97A4CC433EF for ; Sat, 4 Jun 2022 01:32:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6996F8D0001; Fri, 3 Jun 2022 21:32:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 563478D0005; Fri, 3 Jun 2022 21:32:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D8288D0001; Fri, 3 Jun 2022 21:32:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1F6038D0002 for ; Fri, 3 Jun 2022 21:32:44 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E89B0583 for ; Sat, 4 Jun 2022 01:32:43 +0000 (UTC) X-FDA: 79538829006.10.76504E9 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf20.hostedemail.com (Postfix) with ESMTP id 58B731C002E for ; Sat, 4 Jun 2022 01:32:22 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VFHNL2w_1654306357; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VFHNL2w_1654306357) by smtp.aliyun-inc.com(127.0.0.1); Sat, 04 Jun 2022 09:32:38 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/3] Add PUD and kernel PTE level pagetable account Date: Sat, 4 Jun 2022 09:32:28 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 58B731C002E Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf20.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.44 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Stat-Signature: x4tqja4ccys8dmd9tj6t9t3b8uz41s19 X-Rspam-User: X-HE-Tag: 1654306342-897063 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: 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. Please help to review. Thanks. 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/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 | 3 +++ include/asm-generic/pgalloc.h | 18 ++++++++++++++++-- include/linux/mm.h | 24 ++++++++++++++++-------- 9 files changed, 51 insertions(+), 17 deletions(-)