From patchwork Fri Jun 16 11:08:16 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: 13282627 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 D5D01EB64D8 for ; Fri, 16 Jun 2023 11:09:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C8076B0081; Fri, 16 Jun 2023 07:09:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 676878E0001; Fri, 16 Jun 2023 07:09:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5173B6B0083; Fri, 16 Jun 2023 07:09:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 405BE6B0081 for ; Fri, 16 Jun 2023 07:09:39 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 11EE31C8F80 for ; Fri, 16 Jun 2023 11:09:39 +0000 (UTC) X-FDA: 80908340478.13.88D3647 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf08.hostedemail.com (Postfix) with ESMTP id 771D3160021 for ; Fri, 16 Jun 2023 11:09:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=j9Uzlewr; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf08.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=1686913776; 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=N21LFn0bJw0zSofrkQfU13OVWvgTQgm6wU9sahNmz2k=; b=Kf6mVUpdnwDpXUkecr0zZql9/khlFnxi2ekZU+OUJ3j0Vm8p84wV0MKgUCTVoHNUd45gAB pfbBZZ1hUwyyQZm1Dzmfobfk96gbgPIdbYKX8MGLbXBzN8j1FD8yZy0D/Dnad3qkewvEVw 0hHu5jGfFsaF0laXZBzM+aBZD3LMBGk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=j9Uzlewr; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf08.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=1686913776; a=rsa-sha256; cv=none; b=Izi/oUmGP4GsZuilFL/ZkgqJU+L2qYcXYfooGEPhgvb0bnm74qLDvWPTBIvyl66KyqSj8O XXJgVU+l8zhvfUPrQByIN4mfVibjOyiwqGA51g478D8qOCiyiKHiOzHBF0hlhuh8gHk7Sm 0ao3i2dskEfACv/AS5MDvUMwD1EkAiE= Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35GB8BKn015694; Fri, 16 Jun 2023 11:09:26 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=N21LFn0bJw0zSofrkQfU13OVWvgTQgm6wU9sahNmz2k=; b=j9UzlewrJRErIYFUfcJMJFGpiFO85DRypxsnMU6gEolW3H7Mih7poMLxHszmGNY7WDkH Ldzc8+sSifk4YTMlhOmjvKgFaNzRd7uZ6nS1RSwCTo8/fpJlWbDjHXWM9NikEaOWMr2w fFLYGEVnr+BeRMIWQmJ5OGqHeO07nXPWypsOqwBt5orHgfa8NqqHFY4bTipmPhwD3nHO SEuRlvPkAArAkk1eXMcP8AQG4hJbOXduBoqhTchgsRapPTvNKHmHOBl3ZsDG7seiKt4v ez+k33WRSDcp6oqiJHJLQIrEKN23EaNqaSz4YzKuxLeo4ovFZCr3iRzfkGL81IXkYJaT Ug== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r8p9m8aax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:09:26 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35GB9P5H019087; Fri, 16 Jun 2023 11:09:25 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 3r8p9m8aa8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:09:25 +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 35G9VjPn027195; Fri, 16 Jun 2023 11:09:24 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3r4gt6gxxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 11:09:24 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35GB9MuB28967192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Jun 2023 11:09:23 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C6B565805D; Fri, 16 Jun 2023 11:09:22 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C6445805B; Fri, 16 Jun 2023 11:09:17 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.52.24]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 16 Jun 2023 11:09:17 +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 v2 06/16] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support Date: Fri, 16 Jun 2023 16:38:16 +0530 Message-Id: <20230616110826.344417-7-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230616110826.344417-1-aneesh.kumar@linux.ibm.com> References: <20230616110826.344417-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gcZHzsUPhJ6vpRBn9biPPQH_ag3gnr6_ X-Proofpoint-ORIG-GUID: J_F5AjAuhX1jIBVYFZWa5-9r-All94eo 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-06-16_07,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306160099 X-Rspamd-Queue-Id: 771D3160021 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 96g16i8ac9zpgkod766sbcw7sm6xcrmo X-HE-Tag: 1686913776-943905 X-HE-Meta: U2FsdGVkX19pXr7ZpbDP43ipoqsIdZ3LoHilZ4eaDGV5GO3ClmOJucRkRKgPLaXjLeI9qK4jJ+F053Fl7PH4d20/Uh0IetIGpiSj2E3G4hEy8WivovcfWTElEV6vUdCSmDr99mVscTf7dU0pdwK05FuSm7B1U0Ay8V+M2uXpHCT1lmjhiHpOA8eZeQdUUtKTOI6NeC4cKnMQcehyaiXx0brooD790u5eCF9RjSjxlYHg1+LjdspJ3pFLyVAhrSfNiFOs3zD93jWPiIq0QJ4YTkKWDbRJJoAaoGrENTlwnfE4oONELBfclrpvSdqAwgfOMf00U1cwAkyUubvRuXVgKXMl71A4qb3q/0IAL5FW6zOVTzTFwdZF3p4vqGYi7bwHPQNdzy89E5zs27LZKp2l6ymiHPDCilFn+jNAKg45YS2KrvZPbj6B7KrDvpQxYJtvS7uUHTca04uC2h+dgoVlJU+Q/WAM/aTiE23dwPGYkEBlrmDKJcATRxo4pIIG2fetH0hZZgRG93VDnsxjMyM3FaxB5UI5/pCNl3P64jajLOasS5kqNeh5K4+CG7gA8aJcDN52unn0E4WK/QhupoVBKV+c4/xpwrKn4AANztG/w2FP6AS2Jr+8lRGx9R6xuBor34UVIvtenszn/v0SkpvW1YwBKZwRJyfU6TFiXeR8hSPT0Xiw1pGlK08FhmjchQkXp4OgPtYsOn231V/p9VgfDL1RlT6/vAIPm9nvytL1zMuTnr7uhsuQK9jZcPllAFSiyY1nupBSdCT3uarD1JzL8ZhoZY/G6vnIxoipjXqF/CwBCJ5CyXetL7NMhI/+Xzyo3dNf5V7wvu3yHAhVUezPitHAVEhcS+BNw4i2hiuUP0h/mV3TIJpIz+lWArG5mj1JI53tXPme4qw2B7/dCPUr9JEQcuYK7AIO8I1pR5I2V05OMqkmk1wq+j1v/Eo6h23xw0vW+MsnJ+xxTiw5wjI RQSiZ6i9 Gr63Li5AexgAbZK3HYih6FHaOgVm5iW3CXGvDscpZal6CYIeklyd4SMZouoQ3T9Xv+vBcFFf5cWQyZE1IZ0yowibFCfww4ArVk+nr64O8bm1BQXvYCcMODCteJBAU2oN28tgP4udmjBaGYmY= 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: Architectures like powerpc would like to enable transparent huge page pud support only with radix translation. To support that add has_transparent_pud_hugepage() helper that architectures can override. Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/pfn_devs.c | 2 +- include/linux/pgtable.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index af7d9301520c..18ad315581ca 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -100,7 +100,7 @@ static unsigned long *nd_pfn_supported_alignments(unsigned long *alignments) if (has_transparent_hugepage()) { alignments[1] = HPAGE_PMD_SIZE; - if (IS_ENABLED(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)) + if (has_transparent_pud_hugepage()) alignments[2] = HPAGE_PUD_SIZE; } diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index c5a51481bbb9..b3f4dd0240f5 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1597,6 +1597,9 @@ typedef unsigned int pgtbl_mod_mask; #define has_transparent_hugepage() IS_BUILTIN(CONFIG_TRANSPARENT_HUGEPAGE) #endif +#ifndef has_transparent_pud_hugepage +#define has_transparent_pud_hugepage() IS_BUILTIN(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) +#endif /* * On some architectures it depends on the mm if the p4d/pud or pmd * layer of the page table hierarchy is folded or not.