From patchwork Mon Jul 10 16:08:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 13307367 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 69E3AEB64D9 for ; Mon, 10 Jul 2023 16:09:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4DF98D0001; Mon, 10 Jul 2023 12:09:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFDC98E0002; Mon, 10 Jul 2023 12:09:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9EB88D0002; Mon, 10 Jul 2023 12:09:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9C5B18D0001 for ; Mon, 10 Jul 2023 12:09:45 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6F2E4AFA0C for ; Mon, 10 Jul 2023 16:09:45 +0000 (UTC) X-FDA: 80996187930.09.BD2ECAE Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf07.hostedemail.com (Postfix) with ESMTP id CF35E40061 for ; Mon, 10 Jul 2023 16:09:10 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ly1uqkRE; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689005351; 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:references:dkim-signature; bh=avsSqBmtIw8X7zth4yLOaE23VJsCf2jWt5uEhh/d5ko=; b=vshqMI6PdopcYFWgr/CWGmMMg9xT1GUJ53r9iJG46aMFvecHEJystwhGz+j3mPR0NFWlnJ R7cNLvaQrkS/zfQej1WS35SPijy1w2HA62X9wcQ9iRFDdzZMoqBKG+KmeaHDQ6DhJ7NaIn PpyRcHgeNjonpvAn7kl/2zF925IJjj8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ly1uqkRE; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689005351; a=rsa-sha256; cv=none; b=yNCylmq8rvzV17KkzBVfaPAlOneKdRmCjmOGi83PsuLaltjiWujXx3ub0hKwwOlvD6GtEl sS3+WdjY7VIKOGyjdz53WQJKOIakRKJzSy6yedUXkLZIbxXv8zvJR4dTlvAfs6MM6SSLcq ITRa1UcgsItvqzsdqOkgeppEqL0w5+I= Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36AG0gke001389; Mon, 10 Jul 2023 16:08:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=avsSqBmtIw8X7zth4yLOaE23VJsCf2jWt5uEhh/d5ko=; b=ly1uqkRERRDpgHriegstan308Se3mtKg2zx7xXLSR1XswO1A8o7m4U0OEmbBaI45JOqi Vb/FgAZ7YjqvbgDXQI8PMoNK3pKkm4PDXnkvYA57oIQcvOSXb0Wpyu0+PyvKLNC+lNu3 e4ud4miwPZYj1dcQXuBHKh4A/U/I+dy2CufnWesYCVuHdWYHMK/TKBaQ1G6WDCw9DAhF nwhC9DyPdDRbDvQNV6Hfi92YDXDUn+GYFMCU3+tj5XuGo+DcuuvsV18NNsyKOKJw32tu 2in/JpO9t2vsv0AAldvstPMqmzh7+tkRT2Zhr+w1dDgeBM5FTm5m7IbR1dqb3IxWkSI/ TQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rrn0d0dw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 16:08:54 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36AFt78I011262; Mon, 10 Jul 2023 16:08:54 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rrn0d0dvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 16:08:54 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36AG0ZUW014443; Mon, 10 Jul 2023 16:08:52 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([9.208.130.97]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3rpye5jnd1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 16:08:52 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36AG8pfS19530400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Jul 2023 16:08:51 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A76D45803F; Mon, 10 Jul 2023 16:08:51 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E820058061; Mon, 10 Jul 2023 16:08:45 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.9.86]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 10 Jul 2023 16:08:45 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org, akpm@linux-foundation.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: Oscar Salvador , Mike Kravetz , Dan Williams , Joao Martins , Catalin Marinas , Muchun Song , Will Deacon , "Aneesh Kumar K.V" Subject: [PATCH v4 00/13] Add support for DAX vmemmap optimization for ppc64 Date: Mon, 10 Jul 2023 21:38:29 +0530 Message-ID: <20230710160842.56300-1-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UHBRW4tIa1hm0FO60lQ40rtn1vUpwO01 X-Proofpoint-ORIG-GUID: nUp1vSJKqpJQ5VYdhjvmaC0gyjMIyfLk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_12,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307100145 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CF35E40061 X-Stat-Signature: y8uiaxsccouh6ji7nzm18tetbszwc83s X-HE-Tag: 1689005350-853057 X-HE-Meta: U2FsdGVkX18PlYNLYpZQQmWdlEjyuUut3Z9Pxeo98AXQGHc8helwuRHYCwtDSFBmHzPOJ9hxFDgsndyN/JdEJvezQLZVXy+HV0DSby4TAc8QOuNKPMUu3CUTOHL6bq3JS6iyOcKH5t9BP+BEP071i8OZonPAMfD7lzYeMcsLP9QEAC8NQxwxJK+oTC+seUkicEh0Hmxize0RleweOIYEwRnWkJxr77nYfU/c4X1GLrrOCyd6Yy3vb6+p7zMPqEJe3hZ4TZ5iLtV8+5hWjrEGpp9STvME2NlgNNFlsD87ffUsckY5MG4qHaMSNVnTBP1LVLq0gn9rKMM5bakNowc/S57UDsgIHGqKmvb/9Ikh9eYVvyRaydkMk+6VYalKuOPshC8s4d3b1nWSSlFQRkZ2ERvhCnrt9GIwJvUr1OQ18X5lSMaBSMzHuqorhaalmqgaECGy0gIy9jZnMmhN0HIOmVGHn7Eixb5VrAGjaRBq9WhOVSMkAvnB7d1E3873rxlSZMt8pBd7YdMp4ybB2q0p+G4VKwPqMlyrqO3Xpaa2+7o/HIIf6BtQxRN3qKJx/4ByF6l3URT+vCilroplYHB3DDbivdUsDw0pe/UE3YGqrg+ni/CpRkzZ9y/GFGM5MCDWznRqa8S5HS5mQIe9qniMpXY3u/g8GeJ/B8iRT4K0H8CdqRuPObrNQ+mm207pzcVOa+DPiSFf2bP1VVUe85wh3P/nkT+MDtyRdJEcPZQTxIo/wPxGskAhiQiPVw+299E2JVPB+k8MmrVQdBOGNIs9O4KnbinURK7w69Ls2xx/rPwfxYUxm5Cb2rNcyXhDPej5ESOdwCEVglEPMiat2F3ivev3oVLHlDPkhuba1kk8rK3d3gJ2lSUQJgVicwjDPA8lX499OrJAdyRuZ8RrFUS8NI3+FNSGM0tCQvS1dzxZf6bNu5SUG/mEvQuS4FCCDN/vWV/xYh9EkHxWVt/6SYF dRn92KeX ra9zeX/uVhTN39zenDjYAYn3ofX5IUDi1sDUPq8ho0eRnax/GlaxiCNHmYwlEbSQugm6sTh745X8GDXowRisBJLeSEZZHv+F44EPV2toaZZMkInthyO2P2vu8oA== 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: This patch series implements changes required to support DAX vmemmap optimization for ppc64. The vmemmap optimization is only enabled with radix MMU translation and 1GB PUD mapping with 64K page size. The patch series also split hugetlb vmemmap optimization as a separate Kconfig variable so that architectures can enable DAX vmemmap optimization without enabling hugetlb vmemmap optimization. This should enable architectures like arm64 to enable DAX vmemmap optimization while they can't enable hugetlb vmemmap optimization. More details of the same are in patch "mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization" Changes from v3: * Rebase to latest linus tree * Build fix with SPARSEMEM_VMEMMP disabled * Add hash_pud_same outisde THP Kconfig Changes from v2: * Rebase to latest linus tree * Address review feedback Changes from V1: * Fix make htmldocs warning * Fix vmemmap allocation bugs with different alignment values. * Correctly check for section validity to before we free vmemmap area Aneesh Kumar K.V (13): mm/hugepage pud: Allow arch-specific helper function to check huge page pud support mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override mm/vmemmap: Allow architectures to override how vmemmap optimization works mm: Add __HAVE_ARCH_PUD_SAME similar to __HAVE_ARCH_P4D_SAME mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization powerpc/mm/trace: Convert trace event to trace event class powerpc/book3s64/mm: Enable transparent pud hugepage powerpc/book3s64/vmemmap: Switch radix to use a different vmemmap handling function powerpc/book3s64/radix: Add support for vmemmap optimization for radix powerpc/book3s64/radix: Remove mmu_vmemmap_psize powerpc/book3s64/radix: Add debug message to give more details of vmemmap allocation Documentation/mm/vmemmap_dedup.rst | 1 + Documentation/powerpc/index.rst | 1 + Documentation/powerpc/vmemmap_dedup.rst | 101 +++ arch/loongarch/Kconfig | 2 +- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/book3s/64/hash.h | 9 + arch/powerpc/include/asm/book3s/64/pgtable.h | 155 ++++- arch/powerpc/include/asm/book3s/64/radix.h | 47 ++ .../include/asm/book3s/64/tlbflush-radix.h | 2 + arch/powerpc/include/asm/book3s/64/tlbflush.h | 8 + arch/powerpc/include/asm/pgtable.h | 4 + arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64/pgtable.c | 78 +++ arch/powerpc/mm/book3s64/radix_pgtable.c | 573 ++++++++++++++++-- arch/powerpc/mm/book3s64/radix_tlb.c | 7 + arch/powerpc/mm/init_64.c | 37 +- arch/powerpc/platforms/Kconfig.cputype | 1 + arch/riscv/Kconfig | 2 +- arch/s390/Kconfig | 2 +- arch/x86/Kconfig | 3 +- drivers/nvdimm/pfn_devs.c | 2 +- fs/Kconfig | 2 +- include/linux/mm.h | 29 +- include/linux/pgtable.h | 11 +- include/trace/events/thp.h | 33 +- mm/Kconfig | 5 +- mm/debug_vm_pgtable.c | 2 +- mm/huge_memory.c | 2 +- mm/mm_init.c | 2 +- mm/mremap.c | 2 +- mm/sparse-vmemmap.c | 3 + 31 files changed, 1047 insertions(+), 82 deletions(-) create mode 100644 Documentation/powerpc/vmemmap_dedup.rst