From patchwork Mon Jul 10 16:08:36 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: 13307369 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 6BBF6EB64D9 for ; Mon, 10 Jul 2023 16:09:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAD2A8E0005; Mon, 10 Jul 2023 12:09:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5E7F8E0002; Mon, 10 Jul 2023 12:09:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFEC78E0005; Mon, 10 Jul 2023 12:09:55 -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 B03F68E0002 for ; Mon, 10 Jul 2023 12:09:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7454A80186 for ; Mon, 10 Jul 2023 16:09:55 +0000 (UTC) X-FDA: 80996188350.03.0B1A97D Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf12.hostedemail.com (Postfix) with ESMTP id 03B0D40016 for ; Mon, 10 Jul 2023 16:09:52 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=kCArlejN; spf=pass (imf12.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689005393; 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=P+AZIqnopT1dy9laW4Ph6z8M3DAEFIp4FvwjX5DVsDo=; b=2J/U5TLBhAdBw8ooi8RLVOOpc83sCwLHGifotVrpMEdf94eFiHOvDwBKc25mBTBX7Hur7z DYz1tp53WpLMyZqb2SL+/3LpXsFLVrkBFxuIqR2W/TGG5x9voVFTJAtN6pKOTyBRwhIByf 1PRFd6GgoIIYXotLJq47yuN4pxs5qjw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689005393; a=rsa-sha256; cv=none; b=lR/8SLlLuo4JmWy59W6OjJin3B1uYXnbeR5L4Tu2V8Eou+mRaRF3INBGXOHrYgkfiEYDk1 Nib7DDuHvkQ52GbTeL8lleklAm/sZJx7vF9Rpb+OlET3Dk1kJ9GE4lbFVlZB6Ztgh/HoJ/ tYppPLlsbKATJYp7ms+FBoO9e6oXCrU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=kCArlejN; spf=pass (imf12.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36AG6u0P022271; Mon, 10 Jul 2023 16:09:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=P+AZIqnopT1dy9laW4Ph6z8M3DAEFIp4FvwjX5DVsDo=; b=kCArlejNyJEpZ4iK2UfmX2NNpjTVANeJgWBikfNLsoExMDAGqt5nCx+/I7r3BwS4UeHL 5cM+40jOJiF8KFrCyyfN4AMx89/Ffp/fAq0pAD4o1DXSEyklWdd756qdr2NhlWWsfn0t YO1sDCIcaVWl39NaWLzv09qeyEyt1v3v6aOO5OtZDCb9HIUOogvKfmcGTAqD/31SiAAB 41DdlIqva/p1JudgPy5Kir0dZ2W3fDKabNjgLJv8s8a8smjPqnFxE5bYqofcKy/ZdwQy GA0gSofCX+i0dQAP9oIlMT/uKkjViaSRCFf9KwQ5CLOIFjUSbzKu3ULo4Eln1UlLbm0/ iQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rrmxh8gh8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 16:09:40 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36AG70di022982; Mon, 10 Jul 2023 16:09:40 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rrmxh8ggp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 16:09:40 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36AEJ887005249; Mon, 10 Jul 2023 16:09:39 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([9.208.129.118]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3rpye60kq9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 16:09:39 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36AG9b3o3474092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Jul 2023 16:09:37 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56D5858056; Mon, 10 Jul 2023 16:09:37 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C2C05803F; Mon, 10 Jul 2023 16:09:31 +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:09:30 +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 07/13] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization Date: Mon, 10 Jul 2023 21:38:36 +0530 Message-ID: <20230710160842.56300-8-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230710160842.56300-1-aneesh.kumar@linux.ibm.com> References: <20230710160842.56300-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: isLGc3SvCmJ6YoWaUNk62wHBU3Q0HnO0 X-Proofpoint-ORIG-GUID: 3_EhPL9KedALYPy_LZ7tceuWpHNNmP9K 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 clxscore=1015 mlxscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 phishscore=0 malwarescore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307100145 X-Stat-Signature: ij3d5usp4eutfsu4wkjtpkkrd4xf89zr X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 03B0D40016 X-Rspam-User: X-HE-Tag: 1689005392-60149 X-HE-Meta: U2FsdGVkX19megStikK3C5dYQqqqVLesHZFNSRByfItG5o6dFm94+e2YGyQ/z6Nv3woIB0I6XOHjI3Ar/OGqMUHmSWVy6sQIMWjR3eI3rkbpNClANafWIu71zOEcJ237sqx9/WavOeu9OHqrTuK9s7jAzP7XK8UjcBWhQxJ3icuowIz8iADMV5pdrtqWMGSBzyW1YSd9ZkN4TUvCPhbaTLbR7mhOz+GCKziMr8rS4bi2KzepdZTrKleMIFckuU6KWkYNkkp/easRqD5aK6RouOr1o9qA8e+TAE4MwA0mrQNcIAVc1FTVTJZ5HWVn7y1k5u8ShIQl44SiCSwkwf1LdU3gOQhonfL71IJSWRwMgjJVX8I53aLbIKRVpDFPcOIS7game+eh7RphK9M9mC5uTo6k547sZMwN/LAgSIEluSB+NB0z3MABvJ2LEAHxeUE5w3pseFh4J8QfDHCAc/nOdjHuWirmQxcSS4mXfu7KOQdV12GEszvZB2iB/2So7Fj6vIj1EB6xELaxbwl5u+7zUCm+JSXJ4UofXqE5JbabqNeWKlPvsch07BXtQOPvlSKgmNuBC18BC1m0qdEXpm7PaxhteCnPmxP5RJHR07gxyG7ijUSecUTaZ4OLZy31z3oXCu4dsywBTcLB8G0Y3aEFqVrUX/MmenobZAnedGK/cOaIpwyxh1aksxZI+9kvJYkiQxwFskv0XQFU9bRVuf1r0qsmH6fYJY1gA0b/Udboe267YN9bS8RpTlvJ3LrQ9qVkDrUNffcgyXI7GvauiNCO39xi7JZl/TbpthGXYAWi0ER1QBYtz4ySGb0vXrN+gTUq/mVm6AoxwlWZ75ZaIwnGoB0jGAIhlQdIDzP2LfFbwm+UizqSsC2F8kyJ3wvVSnmZXjDmPo/UGkWr8NJbO3LIQlhQ35nc6z/t4ICnGI20SDitW9/mWsitDLWG8z9tb+xVmHVMcyy7MioAI1jYSUx 1sJYH3sp kANqQ1I2RrWVESDkSmhNJzy8i9QbjJCz7priwP/36SYSD1Si8jd0s/jE6HNmlQwXvUx3y1Kin6/BSRrCEo/tRNaUBzZm0Zsh2mUmEhzKGwyXmt4kiwtyENCf9dsJe/8lXPD+p/gcqSvrB7VrA5BaRnG54UffYrxqcIEcISyYTHudFMmU= 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: Arm disabled hugetlb vmemmap optimization [1] because hugetlb vmemmap optimization includes an update of both the permissions (writeable to read-only) and the output address (pfn) of the vmemmap ptes. That is not supported without unmapping of pte(marking it invalid) by some architectures. With DAX vmemmap optimization we don't require such pte updates and architectures can enable DAX vmemmap optimization while having hugetlb vmemmap optimization disabled. Hence split DAX optimization support into a different config. s390, loongarch and riscv don't have devdax support. So the DAX config is not enabled for them. With this change, arm64 should be able to select DAX optimization [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Signed-off-by: Aneesh Kumar K.V --- arch/loongarch/Kconfig | 2 +- arch/riscv/Kconfig | 2 +- arch/s390/Kconfig | 2 +- arch/x86/Kconfig | 3 ++- fs/Kconfig | 2 +- include/linux/mm.h | 2 +- mm/Kconfig | 5 ++++- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index e55511af4c77..537ca2a4005a 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -59,7 +59,7 @@ config LOONGARCH select ARCH_USE_QUEUED_SPINLOCKS select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_LD_ORPHAN_WARN - select ARCH_WANT_OPTIMIZE_VMEMMAP + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select ARCH_WANTS_NO_INSTR select BUILDTIME_TABLE_SORT select COMMON_CLK diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 4c07b9189c86..6943d34c1ec1 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -53,7 +53,7 @@ config RISCV select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT select ARCH_WANT_HUGE_PMD_SHARE if 64BIT select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL - select ARCH_WANT_OPTIMIZE_VMEMMAP + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU select BUILDTIME_TABLE_SORT if MMU diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 5b39918b7042..975fd06e4f4d 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -127,7 +127,7 @@ config S390 select ARCH_WANTS_NO_INSTR select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_IPC_PARSE_VERSION - select ARCH_WANT_OPTIMIZE_VMEMMAP + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select BUILDTIME_TABLE_SORT select CLONE_BACKWARDS2 select DMA_OPS if PCI diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 7422db409770..78224aa76409 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -128,7 +128,8 @@ config X86 select ARCH_WANT_GENERAL_HUGETLB select ARCH_WANT_HUGE_PMD_SHARE select ARCH_WANT_LD_ORPHAN_WARN - select ARCH_WANT_OPTIMIZE_VMEMMAP if X86_64 + select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP if X86_64 + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if X86_64 select ARCH_WANTS_THP_SWAP if X86_64 select ARCH_HAS_PARANOID_L1D_FLUSH select BUILDTIME_TABLE_SORT diff --git a/fs/Kconfig b/fs/Kconfig index 18d034ec7953..9c104c130a6e 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -252,7 +252,7 @@ config HUGETLB_PAGE config HUGETLB_PAGE_OPTIMIZE_VMEMMAP def_bool HUGETLB_PAGE - depends on ARCH_WANT_OPTIMIZE_VMEMMAP + depends on ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP depends on SPARSEMEM_VMEMMAP config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON diff --git a/include/linux/mm.h b/include/linux/mm.h index 1a2234ee14d2..83f51ec0897d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3640,7 +3640,7 @@ void vmemmap_free(unsigned long start, unsigned long end, #endif #define VMEMMAP_RESERVE_NR 2 -#ifdef CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP +#ifdef CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP static inline bool __vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap) { diff --git a/mm/Kconfig b/mm/Kconfig index 09130434e30d..923bd35f81f2 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -487,7 +487,10 @@ config SPARSEMEM_VMEMMAP # Select this config option from the architecture Kconfig, if it is preferred # to enable the feature of HugeTLB/dev_dax vmemmap optimization. # -config ARCH_WANT_OPTIMIZE_VMEMMAP +config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP + bool + +config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP bool config HAVE_MEMBLOCK_PHYS_MAP