From patchwork Thu Jul 6 08:58:06 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: 13303373 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 BFFEAEB64D9 for ; Thu, 6 Jul 2023 08:58:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 580E38D0002; Thu, 6 Jul 2023 04:58:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52FD98D0001; Thu, 6 Jul 2023 04:58:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F7008D0002; Thu, 6 Jul 2023 04:58:57 -0400 (EDT) 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 3118F8D0001 for ; Thu, 6 Jul 2023 04:58:57 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F0943A0524 for ; Thu, 6 Jul 2023 08:58:56 +0000 (UTC) X-FDA: 80980587072.25.56F408E Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf10.hostedemail.com (Postfix) with ESMTP id 8B76FC0006 for ; Thu, 6 Jul 2023 08:58:54 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Q2Ou1NSx; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.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=1688633934; a=rsa-sha256; cv=none; b=KeTUnXmnXoltWdRD92bQNNFN8PzBz5CSgSw2zrH3QSJflhXCyMWZDUswkf4SKuBMuyJGEc qX14R4HhVKuWVs53iNgpj5OELOwopvQkBP2alQgqgOdQjLd46zV+uJP3BoLakyQGvtMQ/L f5/l3Itt+KfJiI+teo7C38ooeXHBD3k= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Q2Ou1NSx; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.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=1688633934; 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=jya01t68fc8JLK+hrfh2OjUWWhl2B94Pgkkk7lQjqRU=; b=U4nA11cTk0UREW+Ln9PoGsBfl8iZVfySbvLJOGkgemL6fGTLe+h3D11oJtvD9qsAEJKjN1 M8wWwJumvmvryL5BpDHfmRdHjRAZfs/V7hoe0kIj/6oZ8kyMjYxvZVRuRYrYIKXEvenZGy clySVdSz4sDgqgeeECvju+cSxzCpazc= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3668ldjG022190; Thu, 6 Jul 2023 08:58:36 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=jya01t68fc8JLK+hrfh2OjUWWhl2B94Pgkkk7lQjqRU=; b=Q2Ou1NSxAEzImOb7iRroYl3Hbt4XhI5yZlE74qcw7xaSP6hKpLD4dJ/APBRApEuoMCDr w+0DKYjBAD9x4lrYmuGsZGfEqoS19HHBfSDCNOSj9PSMxpCY2vYYsPiFIEOaMo78GLuT NtimeO7/+iDK4DDdEjf75g5Rm0J9ZrTQSHv17QIHl7vHInoVMubfIBzbcXw2P2oJLzvR IIE/dbkGngdlSuTV7te1qmvV97jl4+VXJ+bzAShm00mMOnHaQhlvsYB1AmoFafATguxb chqPm1jOs+P9WrHtkeUsSlZqlUKH6pH1QfTQkF5NaNLTWyLypBq7OaC1fQdc9lzbFmDJ gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rntdp07xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 08:58:35 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3668m3PY023133; Thu, 6 Jul 2023 08:58:35 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rntdp07x2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 08:58:35 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3667mKRp023006; Thu, 6 Jul 2023 08:58:33 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3rjbs5qxyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jul 2023 08:58:33 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3668wWn860752178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Jul 2023 08:58:32 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C85258057; Thu, 6 Jul 2023 08:58:32 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC37A58059; Thu, 6 Jul 2023 08:58:27 +0000 (GMT) Received: from skywalker.in.ibm.com (unknown [9.109.212.144]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 6 Jul 2023 08:58:27 +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 v3 00/13] Add support for DAX vmemmap optimization for ppc64 Date: Thu, 6 Jul 2023 14:28:06 +0530 Message-ID: <20230706085819.827761-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: qfvssAY7Xw1KVvzBFpjpBuE94obUoMzL X-Proofpoint-ORIG-GUID: zoFb5m6H7o8KiZtOzZUJycGVAYIuQAqJ 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-06_05,2023-07-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307060075 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8B76FC0006 X-Stat-Signature: yytjkrq5kckr9bd85nf7croyzry6f9y6 X-HE-Tag: 1688633934-416766 X-HE-Meta: U2FsdGVkX19r/TAmzc31rwetNx1oKwe/DOUjW0Oq0zaG+EghMbbUxNr2ZGSIY0euPEEpXu2nPadlUA1nZfEsZPD/hT2CuxZ9xc5hgFx69ae2gJ9PHFowGf3HI4wNudf0kXz956xCWKLl6+gwUnyzw5sDRZme1r5nINX5iT6PjMgiPXzsQA94GIKYJ302ZZb0Zr4VkXZ9vRX1DcUUzbueLfCxU0fSWdpLTiMNgkhxaa91gnjUS5CSCjZ0js42IJ9YCZiPu1t8mb32glTgEBvrqGosPPWdLThJQZC4O61dhOaIKm/BIQJqSLQIExU5OalwqF3vk7ukXVOsQ7o/o9H1Vk61Qi9ihjGXPowMt7SZua848FvA/li27PBK6+zQb8hWFDbW0lPBtIWsbZPhUUamJY8rn/70rlVehh+2tC5iPf1vI1OsJY/moxd9LJE4lS0kRlQIGm23MsXWGxOucMtSlwmhStLSvw14+ctvyA040zaSTl8f/TPDbAszgTXTUCCRyrai3A4vepNRF/LQG7j2VsBICoYyOM75WsFA0vhC5IE7pf3u4+TCKpSxdRV0vei4jwfKpiwjJ07xd38/ZI9/QxDX4+y/gos9RvkV7b55RcJ01ctpH9uRhfiTwH5V6sOTMracn2IbziDnBGsk6wXLPyt1WwGBwEeFuceRNYsuKZga9MJRGDtAFEt/a2ozAin4BBvXx/GGVA3L4qGCAhYYlHmeTlFJ4ztFshVpwmD2mD9F7WQ0lreJ0X0Na0/0yX8Dlsv8hrjbCY5q129yEFygLPU0q/rhCocJ4YYkfOy0Q2+iOaTfr1912rPhJ0YvyAtR/Ac6aGKNWxWjciF63bi31LEhXESYlP5GQ5RSbNa/bMwlX2yzbrCCZ8rSX0lbdrN1w8ok9b1bVa70gLIhnRe5RRWMYf2B3Ux2Rb8qNCKlBrbZzl9WFPzoiidv53G2MhWJkXCfraaq3ptlk5b9EIX XXv5sJNp Meq9FV9Yoz+F54sCpHMUGKVwN7Y12jgSY2gsIA1b9K82ArGPztX0amkdq9Owre7r7Fc4mYe5ocsEqveZdFwnpGhzpWOcGt9WzIblm2sFGtvJ4l/Gyk9rwAe7Ewl6bG5iEXJCKSM0jzEobh69SmfGSe5W42rFSCrUN62k7HgoqsQu1k4IOfm4nsd2ltHNa7O1FVjm2OQzRSx3LKpMcK4Ky0+p/tg== 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 v1: * 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/pgtable.h | 156 ++++- 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 | 565 ++++++++++++++++-- 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 + 30 files changed, 1031 insertions(+), 82 deletions(-) create mode 100644 Documentation/powerpc/vmemmap_dedup.rst