From patchwork Wed Jan 8 06:57:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13930197 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 DA122E77188 for ; Wed, 8 Jan 2025 07:00:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C08E6B0083; Wed, 8 Jan 2025 02:00:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 670FF6B009F; Wed, 8 Jan 2025 02:00:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 511C56B00A0; Wed, 8 Jan 2025 02:00:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2C9D96B0083 for ; Wed, 8 Jan 2025 02:00:53 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D7686C0F93 for ; Wed, 8 Jan 2025 07:00:52 +0000 (UTC) X-FDA: 82983387144.13.958DC85 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf03.hostedemail.com (Postfix) with ESMTP id 01ECC20009 for ; Wed, 8 Jan 2025 07:00:50 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hH1WCXIo; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf03.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736319651; a=rsa-sha256; cv=none; b=OQRN/gjo6+ppvhaD8NjTD7zMujMcgXy0jCXnfawfsnD14eaXpLh9I01caxh7bZzYMBEiCt +Zj0QiHpsOEfLJUUol6D10w2IR9u8EC8bPq3kNDzYXVoafTfcGHwtWtoGZw9HlyjZMGrvi AbFV1uJnZqTZ6/KGvzZj5FZy1vbp2k8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hH1WCXIo; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf03.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736319651; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=evJHXxUH8wpRsLAfhvt7S2AIimf3Ggw2vmlVHfN1TNM=; b=0XY4xFQ9V6kNNB2IQGMKS0NuMbrG7r2FtmHxk9bTtO/nom53hxltU8b0Z5vNxBheBRVvtu 1u7wbfo5Ytuzz4/2VNmtbiw7FuIPBEnn1vN5lvK7eEzY/3gAiMvaOaoG2h8/amOFFgBVn1 N77V3rDqfdei1nZxeAAdd0esiINtp+E= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-215770613dbso181722965ad.2 for ; Tue, 07 Jan 2025 23:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1736319650; x=1736924450; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=evJHXxUH8wpRsLAfhvt7S2AIimf3Ggw2vmlVHfN1TNM=; b=hH1WCXIoSiUnOcwEKnHtLbX/z9IT9M33cTUtS1NmGa2n7b1qYXi1TM5zS8xHYAnRsd pOq9MYnLX0HJJhvqkfmbGy0cEiGiUFFsKFFnDW3/UzvHxXisweLhHBHRAxD0TBku2AOd tHrCaREhoBTCy7VbUIi0+FwrvlxFaVyaumImiMbas91/0nnedAu+/nlAnEdcrLW24XIL 60G3UUIqbnCIh2iOlJUuy3KH+vUEga0kc30mqToGRc8yyqxI7y1CFc3vUmr4+zzWv0xf 8nskoPpBQmm3x151QCtBBQFqsL0qcUCGGvxgxRO0faD2ZsgH+EZhSVO9rcH7kPZfzycC xr+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736319650; x=1736924450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=evJHXxUH8wpRsLAfhvt7S2AIimf3Ggw2vmlVHfN1TNM=; b=OzK55u7lBvtaqfheDOLdG0ikUZzGt5n0ecY6bwA8XSjWSfHGQ7SFTICBclpL3qnoWB TbXlFMXrAvxEZA2bsXsFgpLJql6RcuWWOg01sQqM+S/wp0ipKKydJbYD7ubzwyBCvX0x IO5vq6cV58fbMwO3HzXtt+iP8p4Otltw6tgmkCNKLDkkdMP6aZm4/f7g7myUUIvfC+ZW o+l5Tz6z0jbXSL8o4gttEwTta5HamSo9N5H7VYm+UMHn+cJLxesIeIg4KyrsiV08QvCw G4c540HldO7NopB2cQ+vtmWdVYzBXf3vOPTQe5aLlZIjy78HB709XXpL+noY8smVWu1u Ohzw== X-Gm-Message-State: AOJu0YwFTLAE/nqx6vc+oqxMiFDtQlPZ1UhDjPk2am0mKjDgO8unyjY0 Ktl+CXBbiPaqsNAz3ptCoLhmidZYGNnZdfNcWNJYbceONY4lebPtUtAVNFGMh7g= X-Gm-Gg: ASbGncvnB3ieaQjgLlXK8/tuWzAzHgwPEtK75+j1F69ga5mtPXfVQV+aUUz4+yA0lUL H4vKnAXM8KBG44WETVw/0ssrKFWoXBZXKRiZiDQZUKHKPfJOhAqpUiQS0b0PesP66dviKRM5EU+ sGGrmrAnVV97ssJsRHWcEI3T5Ss1P8VHVfMO2XL5Lm7Q+jKqJsKlbAEiCZsmfzEGBSeXcRO2Ntl FyZVJRp20yYavZidfCWDtMqyTs+eOIDC/+eiAZChv5nHPufxNH9RmX9RO8yXZ+C+d6gmwWM/I/v laBlF/9R9oHIw8Vb2VR5XQVFHkk= X-Google-Smtp-Source: AGHT+IF9X6lXCsguwyHO5KdCHubvdTIDd4Y888fAuDMWr6lGszjnzuDzetJYvdD8sXl2Z0Y5NvXbNg== X-Received: by 2002:a17:902:cec3:b0:216:7ee9:220b with SMTP id d9443c01a7336-21a83f4f43amr30110425ad.22.1736319649715; Tue, 07 Jan 2025 23:00:49 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca023a3sm320067275ad.250.2025.01.07.23.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 23:00:49 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.com, alex@ghiti.fr, andreas@gaisler.com, palmer@dabbelt.com, tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, akpm@linux-foundation.org, rientjes@google.com, vishal.moola@gmail.com, arnd@arndb.de, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, dave.hansen@linux.intel.com, rppt@kernel.org, ryan.roberts@arm.com Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, Qi Zheng Subject: [PATCH v5 06/17] s390: pgtable: add statistics for PUD and P4D level page table Date: Wed, 8 Jan 2025 14:57:22 +0800 Message-Id: <4707dffce228ccec5c6662810566dd12b5741c4b.1736317725.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: tjxahspz5djycach9g5ddf33upt1aqd9 X-Rspam-User: X-Rspamd-Queue-Id: 01ECC20009 X-Rspamd-Server: rspam08 X-HE-Tag: 1736319650-106221 X-HE-Meta: U2FsdGVkX19IRRtfwReC+KKkchqaL8HQrPaO0vf2xPUY7JDtVa7LH+gtBLQZcTA7xlqDxa5sSUY8453Euu4NdGVJaPA8pHLClEFW5D3my6qw8ZIk7hu1QOlMvF+p1uEF1LWUriE+cJ+q57Kc977EjZAbgTnMrmmXhYpfvatJVIrzhXQmKy5Op4Gji2pU3CrYvLJrEvz0R2zVpiSBEpASVJyVChEIZzV/h5CFdw3+k1eBqT/03vqM6jIs090z1yNDqZP1bq/sxRB2CUEYrgkOvd4e0aBsu2RTnqF8ePFTvubrjpf+vXWxblm2naauusIKJoSRt+Vax4SHthPrw1zI94Fhy+24CHJrejkR702ibG8h87Nchckz02OWW09+r7mijyEGXB+mYlVzOjvnzKsnA1CE76/tSUbxI+QPSHyC+HNgW6u3WCBP2rY9Zt8pyPVvWw1ATjOapUlPQ6iwlMuQX5H+eSPph2YQEIDEIE1GXsgEX1Tsm0UXBF7ceFNL2laYZYqrooUCAqBy4Nxg8MGdtfIM1GUg9go28YnwaaB8yNQcBpxQF00E8wCuae/jR+k9PR4zPV7hm1ZPTRo5gs5HmTsL399RqYVTMrPotKzyUTHbV/6YZRXE87vmz8TyE6wEWiAQuB+WFc+Stzb9HsWfEMliIBqNPsuXzRlYT1Ec0qyjFePFh8nxctG+NW/iwtx1HIE+MIngSlhTEr5OMcNazTTa5X2I5HymIinLhD676/KRNdkVcpA5/E2kjfdVqsSLgP0O8eOWT11C1NIy62O0ug3STlNUCpVs4+5QmHErBDzSmfAsfUn7q//ZQVXCT/7WwyjF3UOw/T/ihbWnsJFmUs4oDm5Ajp74RJR4HhmTRcL0+oFpGLNkE3lbqdvtjvrKWkXXhFA9V0UStuxydPh4YllAvj5sHwWtotJICVqVsw+r/HC+1SyQzy+/ptk6RtbDGzwq50Cffs3ESrRg9Y/ a2i5luK7 XdvP4oWbEpBbRobKxoQi+M+EQBgCl0HYrP4d8hMFxhOmrYr8TLW95qcgVi5L3ZqJtgLBh3LN2PVlN7UJn+97nx9UhFhlHq1NmwxgWfuLB9AC5Yi7s5LXS9px4oeh3HG6vYkiooSN0H7lKznmuIqcM2QhKlvt0WwtzoSOBQFfE7BR9j+GU8u1ubhK0QUn5DmdENaaHz914RbQSNINeXVZ2Xao9DDBsznbP2PkaWBIjFKP/4PFONExt1l++Gd85V65Z2bT6Euk1zemfn9xAgkSA9GTcuhz2ypN5jUi660KnEObAamNQmXcdX4tdxjXXNoVAozYwVcIxVsyGWr2yF2vS8Hj3Pnp2AKw0A+9FHr4EuE9V3uOZi0Tik4zC+XJTL32lDfQt2ehP/pgBgSvDapvpHQxvNtzABjCUnmMZBsOyQ16So0ak3D3Dmq4JXzdXlP2iIE8z5qC2KXZ34ctSPEtVkxREy9oqbsTb882Jgscs1b51id5XxGY6F2aYJKPP/N3sWOlJT9xY3QD9mVg= 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: List-Subscribe: List-Unsubscribe: Like PMD and PTE level page table, also add statistics for PUD and P4D page table. Signed-off-by: Qi Zheng Suggested-by: Peter Zijlstra (Intel) Reviewed-by: Kevin Brodsky Cc: linux-s390@vger.kernel.org Acked-by: Alexander Gordeev --- arch/s390/include/asm/pgalloc.h | 29 +++++++++++++++++++++-------- arch/s390/include/asm/tlb.h | 2 ++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 7b84ef6dc4b6d..a0c1ca5d8423c 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h @@ -53,29 +53,42 @@ static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long address) { unsigned long *table = crst_table_alloc(mm); - if (table) - crst_table_init(table, _REGION2_ENTRY_EMPTY); + if (!table) + return NULL; + crst_table_init(table, _REGION2_ENTRY_EMPTY); + pagetable_p4d_ctor(virt_to_ptdesc(table)); + return (p4d_t *) table; } static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d) { - if (!mm_p4d_folded(mm)) - crst_table_free(mm, (unsigned long *) p4d); + if (mm_p4d_folded(mm)) + return; + + pagetable_p4d_dtor(virt_to_ptdesc(p4d)); + crst_table_free(mm, (unsigned long *) p4d); } static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { unsigned long *table = crst_table_alloc(mm); - if (table) - crst_table_init(table, _REGION3_ENTRY_EMPTY); + + if (!table) + return NULL; + crst_table_init(table, _REGION3_ENTRY_EMPTY); + pagetable_pud_ctor(virt_to_ptdesc(table)); + return (pud_t *) table; } static inline void pud_free(struct mm_struct *mm, pud_t *pud) { - if (!mm_pud_folded(mm)) - crst_table_free(mm, (unsigned long *) pud); + if (mm_pud_folded(mm)) + return; + + pagetable_pud_dtor(virt_to_ptdesc(pud)); + crst_table_free(mm, (unsigned long *) pud); } static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index e95b2c8081eb8..907d57a68145c 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -122,6 +122,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, { if (mm_p4d_folded(tlb->mm)) return; + pagetable_p4d_dtor(virt_to_ptdesc(p4d)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; @@ -140,6 +141,7 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, { if (mm_pud_folded(tlb->mm)) return; + pagetable_pud_dtor(virt_to_ptdesc(pud)); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_p4ds = 1;