From patchwork Tue Jul 18 02:29:20 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: 13316673 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 558EAEB64DC for ; Tue, 18 Jul 2023 02:30:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 888B56B0071; Mon, 17 Jul 2023 22:30:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 838C28D0002; Mon, 17 Jul 2023 22:30:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 700EE8D0001; Mon, 17 Jul 2023 22:30:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 60DA86B0071 for ; Mon, 17 Jul 2023 22:30:13 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 403BD1206C9 for ; Tue, 18 Jul 2023 02:30:13 +0000 (UTC) X-FDA: 81023153106.21.276E195 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf01.hostedemail.com (Postfix) with ESMTP id CC2634000D for ; Tue, 18 Jul 2023 02:30:10 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Ah0yp2l4; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 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=1689647411; 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=715rhLhzLhJUgpXR71g1932iokd16AY/dKQbo2W5yfo=; b=Yckik3P3bo00sYxC10xj/fGVgkNfCOqpTx3tYj1yfkNXtfqAe1jyNS9n4sd2zaZvkmK7oA YGAsNItDeyocjOrghBkQGJqJcemyGK8mcjun8v8IZAhngAPbCLNujLi/wEqP/qfB+beZU+ +kiv6QPSSWIje4X65+a/v5vh95ZA5bU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Ah0yp2l4; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689647411; a=rsa-sha256; cv=none; b=hPrYtxCqjdgJsukQgBf6gX/lPYXSOSiZ9ib+JWInYoFQNEfYc0EmB8JMrsXlDwkOybJasN dS3kjVp03FUZkEZV6TszlWlHUXD5kzR4ghAERnUWjXdmOrOyY/tOoECc29Luiv/sXlBNvF RjWadnrUOer59xmFZFYSxewv42SHZjE= Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36I2BpZ0000532; Tue, 18 Jul 2023 02:29:46 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=715rhLhzLhJUgpXR71g1932iokd16AY/dKQbo2W5yfo=; b=Ah0yp2l4wvuQMY0AEvWFZDp0RdhVyf22UXhBzOc7KlexNLZnz6u4KP3AlpKkJaeWkHHY 9iSrRqj+HMvze+Ww1psjJj9PG36UApFlclrGW3f82y2krDnW4z8Y6tmwx+67vRtGsgk2 5oFCYVPqQQVmN/3VyaTOtHLOs2YRAV27cedfnBe3AbxfgUOPKfZq1iDdAbtDcScCL9PF /eIZWgboax3lv34ixBl/v+rgRRfTNxV55HCg1TgOvF2voNkT3VaNokbEFfmj2yfl4nXF G1MxU/M09EQYD8rIKP3cB2Ly1HDXrc7A+H7Ibb4Qcf+aQX3pi3IW+qRozivycGM4+U7V 2g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rwgy4s2bc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 02:29:46 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36I2Cj4Y002644; Tue, 18 Jul 2023 02:29:45 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rwgy4s2b6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 02:29:45 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36HNMdxl029366; Tue, 18 Jul 2023 02:29:44 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3rv6smbt9a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 02:29:44 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36I2TiFt66912614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 02:29:44 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2ABBE58059; Tue, 18 Jul 2023 02:29:44 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CFEA58058; Tue, 18 Jul 2023 02:29:39 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.62.199]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 18 Jul 2023 02:29:38 +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 v5 00/13] Add support for DAX vmemmap optimization for ppc64 Date: Tue, 18 Jul 2023 07:59:20 +0530 Message-ID: <20230718022934.90447-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-ORIG-GUID: vC60NSx9T2ir1czD0flTuAgrFxoiOFhk X-Proofpoint-GUID: 1kdpuh-NZOGasc2t1IcAhrV1BnDGeRtX 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-17_15,2023-07-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 phishscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 adultscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180017 X-Rspamd-Queue-Id: CC2634000D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: xsj9gac9smiryyg7bu6e87351x9y9jbt X-HE-Tag: 1689647410-396651 X-HE-Meta: U2FsdGVkX19tn8DepW5D/Nbr8JjjpAelQbevuGGjNS6aDky6fto8RY1G6DD4g/oHZVVOYYKQ0E3oLkkBKlZLvtYLHXCdDhliRQBlWWgbEoB2SDB5sEfKMslFdiVmW0O1PEi8iLVpi7WswCPd4NGhVbw3qTtXd0JylaFM4rwLa2s24/zJ8eQYK1BtTNaOYoGQWspf6Q3Q2FEa5LG704l/JK0H/zebZ7q0aFWgH6fI2c7ZWUeUwsSNleOLrVyJLYUH+DwsidcwNXV4GX60R5JZ2oR+9j0kIjRqpWUrmbgpbwLKpXMROZoMlR8dMXtFU/F97+/CKen7knFnEXLnUov3BnZzYST//iNE3KVl855HefRKXLOQJJqJnXlkCSac9o6NAff6Vqq+C3Inl7eE5N5bla7nZBFbi94nYTO4azRfq6KQerfwnl9gNP2h/asPFKbz8QiHNl8a8eeClxCxWO/FhKc8lzDpMqmC4HwM3I1zVaGtNv3+AfkZT7gRfUdpgGzao/a7w1T7jlJ5FSvA4ZMWl0F5sbASWtj7Zt4Jni6Y4Tr7g1zq526hgyGAlDcu8fTt3iO5L90leHJmJRuxOAt7SyPJb4aooY9Us6ThcfArGOJT+v5x+2Y29kmvrqlfvgkMFGwVcjsvECox+cUDogcRKDsDxsdfQ+g3gxdBkTgKqX8rnQQ5/YWvKarB51/4NKj0LvaOynvqPEIXjFDEkeM3fhRB+QM6LnKAgvJQLpmzL1oTdAkBGBMDy6mBhacof87TRQHjdRPsCGCfXPRHYqWICHirm202EJ1XJV8vUrPpW3vSetR9cWoBnl3M/qXzPO6Tq/i+nhVje/aPF92E/fIzyKhhlZ7E0y1p2ZgmR9kIIy4YXPTfIity+I3yEs4WyN43M/dKBLyIczwJB1ZEghL4zV7XECjavFZEAGak1rcf6Lr+eMWeDOVBlqxCZshk2Hua4vbwhbfZm4Pdr6QtwKe GGY5VD4Y +re3TBfH2TxNz2nI1ww2BGs9C+uVKVZKZBy59c/d8l6I5sgbYgLtnTphRSs+2GO2clJdb9hm8TMNKs2Hb4Tv3ZDhM5SaLFqe5q++2AdrCBKNzvhoL2NmRHLRE3A== 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 v4: * Address review feedback * Add the Reviewed-by: 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 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 | 12 +- 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, 1048 insertions(+), 82 deletions(-) create mode 100644 Documentation/powerpc/vmemmap_dedup.rst