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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2D9DCCA47B for ; Thu, 30 Jun 2022 11:11:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8007A6B0074; Thu, 30 Jun 2022 07:11:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67B606B007B; Thu, 30 Jun 2022 07:11:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45A236B0072; Thu, 30 Jun 2022 07:11:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 318456B0073 for ; Thu, 30 Jun 2022 07:11:31 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 0BEAC121315 for ; Thu, 30 Jun 2022 11:11:31 +0000 (UTC) X-FDA: 79634636382.14.DDF729A Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf11.hostedemail.com (Postfix) with ESMTP id 6087040052 for ; Thu, 30 Jun 2022 11:11:28 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VHrqafz_1656587484; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VHrqafz_1656587484) by smtp.aliyun-inc.com; Thu, 30 Jun 2022 19:11:24 +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 v3 0/3] Add PUD and kernel PTE level pagetable account Date: Thu, 30 Jun 2022 19:11:13 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656587490; a=rsa-sha256; cv=none; b=N/rNklNzmfh2IWoHZTISxAVIvGExrfsRjgW4W3Y1m8mqovyc5OYjeRuAS3CnQ7Dbr0XiPh tveOGb+RpygsBBPe0IhxLtjRivkV1mNbHfL9ZYwvgkTvMPHDmzSWmyS6yhALlHO0glFJMB BM92V5+6R56mNLCWdZbt9a2uh528ngM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf11.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656587490; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=lm00sJi2VREP/GHPS7QMBu4MKUA3uT3sZcxhUJx85cI=; b=W+Nq3H5MwTtcOGpV5rF/csCtqWZ4ZYNFE31rrDkaYOq9GkJ5cXK74FH6wL9SUSNDU4qoHF TBdOeh2vTRyiDPUmuXY8xHLwp6OgDu4icRTfn2S1xVFpqEURoH+pWGaBrYPwGCAf5WBrPi fR7WI++PRSQI8znC0354fBnpyaCreRs= X-Stat-Signature: k3t3n7n4ap9x1k1hsrmcdefzku4yheab X-Rspamd-Queue-Id: 6087040052 Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf11.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1656587488-846357 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. 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 v2: - Convert to use mod_lruvec_page_state() for non-order-0 case. - Rename the helpers. - Update some commit messages. - Remove unnecessary __GFP_HIGHMEM clear. Note: I still keep using alloc_pages() to allocate page in this version, which follows pmd_alloc_one() and saves unnecessary conversion pointed out by Matthew. 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