From patchwork Fri Dec 17 10:27:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684201 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 59613C433FE for ; Fri, 17 Dec 2021 10:27:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 829506B0072; Fri, 17 Dec 2021 05:27:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D8CF6B0073; Fri, 17 Dec 2021 05:27:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 678F76B0075; Fri, 17 Dec 2021 05:27:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 5A9C56B0072 for ; Fri, 17 Dec 2021 05:27:25 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2850D180C3C7E for ; Fri, 17 Dec 2021 10:27:15 +0000 (UTC) X-FDA: 78926908830.10.F807D27 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120043.outbound.protection.outlook.com [40.107.12.43]) by imf23.hostedemail.com (Postfix) with ESMTP id C0BC5140007 for ; Fri, 17 Dec 2021 10:27:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BMxZbEfypzPbtFeuUbtPzv5luCgATwjuBTfmKnDwwM4eUGZSWpMNS+WVzU0vSy2XABbZvP+MgRIoi3JFqPQgCudo3Omu2+IEybRqvtm27enndJHnvqMkde3JxGk170OrFXSDQMLr4fD+6Mqmd5RS5QE7vhVB48hxgn11QYdWXYJ0YN02DZGYLgQqOj9y1Ldc7r9qcEKCV5dPeZ7giKwUMXpgpPAWO5pw0DoOQdkGOzoCMf5IGBLsfGY5RVufl5wwnbw2TbG8rri9PLX++pjzM5NxdNKIAEf9genITGFCDjqrczIO0bL06kQQmiOa62ts4Cl/4je52CQ3WhtxAlXBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CecWjS/2UZ0IgcjyZ1BNFW6PGMsjPsk8NnvtJJ1/fvs=; b=bU91vGVLNDC/cJIkU4aoC5YXIX9jaJc/9FZqJfNMya9YeeouS2dGu711uaiyEjBwmxQT3og0fIB14p5L5mitqqEPjC7uhrDw5zEev8HiALDfzYHlQochJNKn2wgX464GpEi1yvw8mI1sG+l1h34vd+K/K8L1rgRfczhNpxQduiU67fgZRem7vaGtuKGzs5jxjHCT+iQvncC4K43uh8d/qFw7HFZ7g4e9GiwSQOVk/YRrne56of1FRyy9Q4SfwbGXpaako0FA1Z/SEBSchVRESR+YW5UT2v8riA9twzVbvw0NCsmt3E8EZ/RsmpCAXENxjiZJ4fPtr+Q+XwriUd6G0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR1P264MB1650.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:12 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:12 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 01/14] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Thread-Topic: [PATCH v6 01/14] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Thread-Index: AQHX8zCnim+p7d3b7kiUzSRQ/JQFWg== Date: Fri, 17 Dec 2021 10:27:12 +0000 Message-ID: <961336afce7a10ecc4e68021246772ee239dbc84.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bfd3f856-e459-4158-e969-08d9c147ca29 x-ms-traffictypediagnostic: MR1P264MB1650:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: u+LQySCTDHRNJeZjhfaPP4s9owXtB63M8KdYl01v0Y5D0Xdipu9ip/F14j0Pcc41VOskYw2KYkzNjROoVMrUGVsDTiU1DXA+l6ITl/o8lrcQGT5lvx3ZidTzGU5QQTbu7fNc3N0/qQLh2JUOmbVjq/QtkYhNJOu+B4kbru2AY3qEqJkHVwTYr3VokHTvsARmfd4EPYTL0Fi8H16GaYKgdnqN839lZDMX3k4Y/PnZkSRLmvveWZaco4754wiLvLr6MxYLH0v0zqabf2JzrHwy3BALN1qKX1z2Wp9CMoyrq/UCPe5+ApSjoKH+jgL3Rvhb/oPwjn3cSsccSw8LMon+u8SUxseq6yP5hd3ipCPEIRHrZSFGwWMk0SgbOoxeJvrccAmcQAErvuxloXTmPiEv+3wIOj2iYENRpGmpXZTRuh9B3/IZyZ5B6nsDLFXXEYOGiKjvC0W6dp2o1ZQ/gOHZ1+GaT9IdK6rsZEykhwUJVsnlJrmcmll3jytUD7/SUOzV1wNHKFzUMXSPsDBdHPIw5bgzQ3YfIm+bL8GgBbFe32wPlRPPIYwRzZ/V/9L+3sjVi8+km5kxZ1c74Ycr7icO3gcKBK7laZM3BSJvBHrU+RCP958+Abr3palCSTAjIHDtF1vgnEx/gP+fNYa+Fdrifciy36oi+ioBxs/UirTay4elEEeZQKWUkpCoT4LI+y1CAHF2IIt++EjqUrwXC+12/Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(8936002)(2906002)(6486002)(6512007)(8676002)(83380400001)(122000001)(36756003)(6506007)(186003)(86362001)(26005)(38070700005)(44832011)(76116006)(66476007)(64756008)(4744005)(66556008)(5660300002)(38100700002)(66446008)(2616005)(91956017)(66946007)(4326008)(508600001)(316002)(71200400001)(54906003)(7416002)(110136005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?CVQNfgrEK10QPVeKAs8up0j?= =?iso-8859-1?q?6Z96hI6RTenzMgnWmludv9hr2yLBRAB5Pii7Tb9Swp6bmArg1tUJVgXeOYTz?= =?iso-8859-1?q?YXrSWQrIlbGE+OVa65fONCv4cN07NDAyI3XzpaFVVCIXJv2RRAifwP7/EshN?= =?iso-8859-1?q?qkjYIDZpldi12ZQ9oQhgJUeInD9W1aBJL6lMwih8sCn0sSc7XN1EVPTgbVF1?= =?iso-8859-1?q?eLKbjCmbibFguBHCLpjplL0kq+xevLB0ObzHkmkL78YpmK7mQPl1MuGM3k2A?= =?iso-8859-1?q?KWHs1rhug4pCkJgXotZ6dxKpfgB4xlzvfSS9aFzOWnwpZtKlnPPlsw7eBg5Y?= =?iso-8859-1?q?8WjTOF8wd0+5JG/jSPtSk5hhEP3k/+jhxEEs+byC+bSgoETRtHeSJUdlufbw?= =?iso-8859-1?q?1S6OywOQa0EOGPaM0eqQaVRJ3sOGb8Kcn5yKVUlP0tlyo5SoJiHU9SAQdK+n?= =?iso-8859-1?q?2cvk8TffY5taaqFNUUdexVGBR+7OzgQRs/XIObTQJZ9G0toEiAGoAQZI/riJ?= =?iso-8859-1?q?PCca93YzRuW++VU3Gb3xAwoKQOhb7lTn16WlJR+GgywHB2HqHVFWYSnw/uR2?= =?iso-8859-1?q?qMSy+SOb1gDkvveI108xaqiYRmeob/25tENEf3UdF2Nf0xPwQ3C/4zJKKWEH?= =?iso-8859-1?q?M8uujVVegiTFE+zL/23pBEQojvc2Ilxa/r94/qybuK1AdndlizWORaVbAeqE?= =?iso-8859-1?q?mOXA0NeZdVLKfvb/uM3Y+xtt/HYuyS3Vq/2O39enVU1AbZ+kgGaxAgzi0b1n?= =?iso-8859-1?q?ZU0dSLxPKK3eu6IbF2PZfPYzzbdhEPNUGzEvotRWQAVDAGtj2hYUXyBwr76P?= =?iso-8859-1?q?aBgwch8W5u7hH49dNfdSN/5dx6nVxhF+9MH6FbezAU3p+EsL9EhymKi32IJb?= =?iso-8859-1?q?6ETp/wj8c+5NFJrq3vdRyvFtlBtKZKsmbufMXTV4aiogykw891ZgNYAquDdM?= =?iso-8859-1?q?6eAJu5xnZV7PgwAwbl9AcXfX6qARAI06Dd2U5IyheB20zxlzFo11UDA0tb+Y?= =?iso-8859-1?q?GytSiSYTeyQfmfnzonIu4xScb4L27uAee1Cfnuybd6kvYL8ukhQJXZp1n6um?= =?iso-8859-1?q?WoH34F4cO+9f6cVLV76PMZVTaqzXkV0O8Ssst7JYAoJKqBGmWB3/jxhDxQE/?= =?iso-8859-1?q?/za7Bvaup3GxCEjxcsvuSClSs08XiYCuXfjlmxY7xMgMl4FxvPassxGWuhFT?= =?iso-8859-1?q?HqhS4JB3swnklXSK76YvpA3zfo9sER/t8uB/MYGDAkzUCqAY1RRGcbF+Zyg+?= =?iso-8859-1?q?M2LbFd2E+WSAdhHio8qRm7IS2oDO7+/KjZcetDVfEG3q2jvPt5Hu9ijaUt75?= =?iso-8859-1?q?Gmae0gI1ZsjJD2ZO6rm3R/V2FkWG4LrTL+Sqsjo5j89s8O2SKJD0Sxp99W9O?= =?iso-8859-1?q?LOS0N8lx+xRIGnbn0Ys3fRDWxldpJeYrObS5jQSmXQg53/XHFWHjhzGSzPZy?= =?iso-8859-1?q?iSNJaW/qugI3MdHPPt3T5K18opm/vD4NrjBR09XApIccKu2Bt88Nu3rBqRTO?= =?iso-8859-1?q?vmqnX97lp+CVANsSeQbFo1aOdRiLdenX4aMMZ7cbcc2H5qrlEyFNfKFh9pG7?= =?iso-8859-1?q?luU2+9GPa05p/ig19ogmFAXvWJV4jg1gueLEIRiOmKCy9lqn0ktjel9awu46?= =?iso-8859-1?q?+8wUZbEVuOACRevzHNlNFBciSDIAxqIWgOoLaXgJfVBjthEwTSG2QEOnaa4+?= =?iso-8859-1?q?17vR4GmI29az7kf3Xo4t5wWMX6XhV5GsR4hqwBvIkiBbESjcQNcMLk4UCR+M?= =?iso-8859-1?q?ZBdk=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: bfd3f856-e459-4158-e969-08d9c147ca29 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:12.7750 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EZsXb5ci4oq4wk8NdrZT7wUfX/Eu2tsN8zPzDBq1am8ZjXVlnBhFaJNvhR/kejEJ7J8G3a3fW50oO6zTIvAahcAfeJdT3o7dzG2gdoqdNLg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1650 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C0BC5140007 X-Stat-Signature: ye7poux8zrx1opjejz5mak4ocnqtpood Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.43 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1639736829-108487 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: Commit e7142bf5d231 ("arm64, mm: make randomization selected by generic topdown mmap layout") introduced a default version of arch_randomize_brk() provided when CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT is selected. powerpc could select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT but needs to provide its own arch_randomize_brk(). In order to allow that, define generic version of arch_randomize_brk() as a __weak symbol. Cc: Alexandre Ghiti Signed-off-by: Christophe Leroy --- mm/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/util.c b/mm/util.c index 741ba32a43ac..46d1a2dd7a32 100644 --- a/mm/util.c +++ b/mm/util.c @@ -344,7 +344,7 @@ unsigned long randomize_stack_top(unsigned long stack_top) } #ifdef CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT -unsigned long arch_randomize_brk(struct mm_struct *mm) +unsigned long __weak arch_randomize_brk(struct mm_struct *mm) { /* Is the current task 32bit ? */ if (!IS_ENABLED(CONFIG_64BIT) || is_compat_task()) From patchwork Fri Dec 17 10:27:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684203 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 E00A3C433EF for ; Fri, 17 Dec 2021 10:28:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51C0B6B0073; Fri, 17 Dec 2021 05:27:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CB2D6B0075; Fri, 17 Dec 2021 05:27:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 344F96B0078; Fri, 17 Dec 2021 05:27:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0051.hostedemail.com [216.40.44.51]) by kanga.kvack.org (Postfix) with ESMTP id 26ADA6B0073 for ; Fri, 17 Dec 2021 05:27:33 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E485B83E82 for ; Fri, 17 Dec 2021 10:27:22 +0000 (UTC) X-FDA: 78926909124.29.39AB95D Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120073.outbound.protection.outlook.com [40.107.12.73]) by imf09.hostedemail.com (Postfix) with ESMTP id A7BAA140015 for ; Fri, 17 Dec 2021 10:27:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jc0o0rlZBnEh4OldiuB3/oaQMFZSrXbG0Z4A+7WszpAgagKCyxWMJXmaE2ybFprAcmihjowWmgFz3OTgzJuuUUW6Ka+/QUu3oY9e6uBEaGEiTuOp9KgNZgvfT4dMwGyTYGluMu4F8YCZ6luYNhg2TZKsxAhCaaOI5rSWAI2tpWlHmue0oyIVgD6oUFe+q0uSuFg8Bcy2NR3uGzpVB9ra14CwQwn2LtBu5A1vSdsgysOWTVpI0NUoqRIju8pn/0LXH7Rlh2RXf20jmNn/IxLAL7odlIb8zDEaElvF+om2Fa00bda5JEysmB+nA29tzRW9ytTECTfQnARG2TfFrWATWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KuKZ8Pp5OoKCaatHC4wZ7EyUM5TYF66Dvkuh8U4yTxw=; b=CjgyxoZzCVVda1+ATmsdDDbfBY/WNZabqirdxkFby7NGCabd3SjBUMaXGDcksE8y33eGsEoYE0xww0HWXHo92Yh5OEkl2KDVDQs7KUAEDSQBfbrOGalLrAGll5FMTRi3GSTncyw3PnPBmISFXijIaOwouO2SF6gyTWim5GGkm/UzrT4ve1997KFigzJOMG+081IkDRYUv4Z3FyaT667eO/Br6nj3aELudbmV9RTyoTggvpAs2QcejefPyjfi5fPkW3N+HE3Z31PsctabbJLjtDbJ4s+yQ58P14cZA5oWDLXhc5vDq9LnXD/qbUU2QVOLvRcQ8YL8rt8ao9of+P5M9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR1P264MB1650.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:20 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:19 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v6 02/14] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Thread-Topic: [PATCH v6 02/14] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Thread-Index: AQHX8zCrhoAF34Ujr0eqThlZaaakHg== Date: Fri, 17 Dec 2021 10:27:19 +0000 Message-ID: <50d176dcf3942894a8dcbc42b7b767b065df9af0.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f5cfc7cf-13bb-4047-43db-08d9c147ce32 x-ms-traffictypediagnostic: MR1P264MB1650:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eEo1TeUDHpAIwUtuH8cwgQuR2Rtk0Q6UbsXFm8deBpD4b2LvUSjxZ38ZlmeocwZwci9rZZ9Fjz9U4gRAmt8mAk6A2ZYvD/lqUDwoDsOCUmBEalRZXtyh1BGg67391WiQy1RehqWntwKIXMD8KOkWc+03BnlCBVEDt430Vxq4G1OtDdjh4qSPOBF6+6pRQ0ZfFsf07I/UVIAwOhQQlM7b1rGLNjaPeW7VZHRWAxDds/vB8fkJFXot6T/aaa2f1UzOpB4fYJL5Oyvf7496b2OXnDZNxOum9g2MEPTnC4JFrpBQ8Oj8cbvCY2+ZCo2hPizvZZcEHhf0SZwBtDNhvsbUchHIfkZBcvIWhlWe6SQmwziGLe26JrR5ugsZhPNkOLgpOHNOo1sTE8Od9OGGP/VMNc3Frg8PgRloMENcog28tbIf+lm5wuXCBTg+kz1qsGLlFyWibE3Tj43eDu55DHci5mRlCTSzUnOdumMKXXljMzbsfptFzouSrLwCtIWpzMmoFP9fLtOL9O0u9Y3HuYu7LUadRvS9EphmhXIiq1SYnAIQ7m8GoEeEM5iDPRcbJCQlsB/vBpsGB20sRfEPNNfby1Xa7yjVdgq5RJCCWU+b9/JnUxhIvjbKt4HiPctXssn7N1XwS8qfdiXnMhFgEjvsqTKC2DlmTu0QzAzxpnkNjqptdUsIbK39p2E6p/5RZpiRzW1W1KR9EMOE/vfjiw7f6J+0hGuBG2/bqKdashtfJUI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(8936002)(2906002)(6486002)(6512007)(8676002)(83380400001)(122000001)(36756003)(6506007)(186003)(86362001)(26005)(38070700005)(44832011)(76116006)(66476007)(64756008)(66556008)(5660300002)(38100700002)(66446008)(2616005)(91956017)(66946007)(4326008)(508600001)(316002)(71200400001)(54906003)(7416002)(110136005)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?Teh8ijjSw3AO7mYFAP+TYs2?= =?iso-8859-1?q?rt2zpOns0WKL7/quKLiU+U/FwwuZCMdYgLQJumr+vAlZrOlInROQSS1RAT5C?= =?iso-8859-1?q?jYGrXZxA4WufVos3qyVvnsSMwcTJeoN8CFGAwTqVq/DnUZKhMWVVdzrVVlvu?= =?iso-8859-1?q?++vaFiw2VDKSKGEgciqK8gB2AA6BI60pvEV4B31iFE5ebq+C/uHwOVaQT+5R?= =?iso-8859-1?q?KWLc9sGmumNjtEQ+ydMZhZZX6lr8rfHgYy5B1cW25ILgcEsCwMrAMKUQUEDO?= =?iso-8859-1?q?m2xKfNX16Z0ASvTn0Vix3r82c5OeLcrW9Bgpy3i7ASI1y86dWQ2Lcv/b9MyQ?= =?iso-8859-1?q?41dtH2kU85GtR8S3aiKbd7H7uVu5hHNUWTGG+siBV8esPcyj8+r9K3nHg3al?= =?iso-8859-1?q?dQEdoDNDOwyRtC9OsI1py3X9CG8HoVauuhyePikDh60LjKr2Q3XYFDIc6k35?= =?iso-8859-1?q?lsMYUpNz+AT+uxorr9p3iWJoTXNcwoZIakT6f5HufRmjxjibT8JNSZye5z+9?= =?iso-8859-1?q?ujdq2WI8h/l9a2DkQNpsMXRrAJDLWR+2IPVCM9mhD70nXLXx/jxXz7EI+XdR?= =?iso-8859-1?q?hX2xGyfQXJaYmmr//NUHvU4VS9DF35tLqCIyTq4OpO3GtCLBRrT4cpsn5VcH?= =?iso-8859-1?q?T9GVjuQyQK9o8zy8DHM7OUx4l5TFzTyaZdEjbHpKYtHHbC4arYp11SsViLCb?= =?iso-8859-1?q?B2f7wFLtS0AbXciT/CO+PA/QQ9chY7R7xy2ka+2MyT85udBs+nvLpBdY8Lva?= =?iso-8859-1?q?/z39Ui0Ep4oRqvOZ15ODfXjKIyMxMg7qyqH+InzWZdHFOjwokzc4tlrmQQSB?= =?iso-8859-1?q?hAsQPK/7HGrP6tGM6qLor1m9V0BC0ZlwZHcdlbsBCctIfwfnR/NSDohT8yo7?= =?iso-8859-1?q?UNWuW7vmvFn1K6aYbVNUrI48NSvmyHO/XrQQC2lxjkf+VkjKifVlrNCDIdZc?= =?iso-8859-1?q?+Rl5j6RHuKgZ6sBYqjzKSiFcBRkaZF055TdV0F9jHU32O2gEy04DKpO2U4AL?= =?iso-8859-1?q?Um7OJ+y4ArzSl/fbfY04np9uL0jBX0t9R2+hLpE7Lzryv00mMonyBOU1ZkQq?= =?iso-8859-1?q?90dSlMj13etIH8ayz3mMP6+gVA+kvvxQYUbfOZK0xpT3e/8xO8AjQAD7I67d?= =?iso-8859-1?q?KudBH9EitLeWhXYsmz/i6BBTQRFEDVPdkQ7GhlP2GF/L8Pk7az/p8Lx3d0fx?= =?iso-8859-1?q?6/NQpIeemf2SeOsBBMPbktxvEeyd7nYb8Bk0cjBOo2Wm7CgCv5AiXAdVqaYl?= =?iso-8859-1?q?D7/U0WSnuXPlUhEWr4vDibkqLHyrN3PlT1bRsODKDYmcKvM7WKOnXAlBxaZW?= =?iso-8859-1?q?cn1/btXYKtu0KP7kgFx7cuiDxn8j+TE5TMHEql/4gkZ+GzgPvbzc3k/p59im?= =?iso-8859-1?q?PGWSnmT/I+r1HDwR/NYDN+2QFC1XCvxgez9XBN8+rfmywjSRAkEqfcU82C1y?= =?iso-8859-1?q?/BZV2AK8d44MKV//mQcbOrZo29UwXlwd9Q8uYqb5qmlx9pt5ZatiItnK9Sbt?= =?iso-8859-1?q?Vs8iJlYW233b0u9Sy3yV594Zn+iLgHfqeqceh7ZzsVC3GJXoSOnWMaZlEtr8?= =?iso-8859-1?q?nOrjbihN056Eu2eL3cjnFCBghRwKVOhNZHSUXc1Yal9dtjhrRGcE9tYZkDtY?= =?iso-8859-1?q?yJZI7m3lbxVsZrBxObe2byqyrVXQYP/IO4tzjp5A7cVZ83T+05TXNnJJRUx2?= =?iso-8859-1?q?4TJiQHQnY+8CZt4m1oCpl20JKTjCsRkTBf7o2r5MoAvuwTm7FvJ3HvBY5/qO?= =?iso-8859-1?q?hZqc=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: f5cfc7cf-13bb-4047-43db-08d9c147ce32 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:19.4481 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /fi2vfcEAMS3PzO0LMFBm5eH6xx3kn/RMwJItDqWqVo7osGRcTSc/tWcStb7iI+3wPlxmqJGghalBmFdbLKn4h5lw4chGXIjbEC5Yf8Yo9Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1650 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A7BAA140015 X-Stat-Signature: edzmzgf8xxbwd5rkqwtcd311r615h8dt Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.73 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1639736838-102622 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: Unlike most architectures, powerpc can only define at runtime if it is going to use the generic arch_get_unmapped_area() or not. Today, powerpc has a copy of the generic arch_get_unmapped_area() because when selection HAVE_ARCH_UNMAPPED_AREA the generic arch_get_unmapped_area() is not available. Rename it generic_get_unmapped_area() and make it independent of HAVE_ARCH_UNMAPPED_AREA. Do the same for arch_get_unmapped_area_topdown() versus HAVE_ARCH_UNMAPPED_AREA_TOPDOWN. Do the same for hugetlb_get_unmapped_area() versus HAVE_ARCH_HUGETLB_UNMAPPED_AREA. Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- fs/hugetlbfs/inode.c | 17 +++++++++++++---- include/linux/hugetlb.h | 5 +++++ include/linux/sched/mm.h | 9 +++++++++ mm/mmap.c | 31 ++++++++++++++++++++++++------- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 49d2e686be74..c7cde4e5924d 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -195,7 +195,6 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) * Called under mmap_write_lock(mm). */ -#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) @@ -244,9 +243,10 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr, return addr; } -static unsigned long -hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) +unsigned long +generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; @@ -282,6 +282,15 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, return hugetlb_get_unmapped_area_bottomup(file, addr, len, pgoff, flags); } + +#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA +static unsigned long +hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); +} #endif static size_t diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 00351ccb49a3..df899d1937ff 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -513,6 +513,11 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long flags); #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ +unsigned long +generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags); + /* * huegtlb page specific state flags. These flags are located in page.private * of the hugetlb head page. Functions created via the below macros should be diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index aca874d33fe6..2584f7c13f69 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -144,6 +144,15 @@ extern unsigned long arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); + +unsigned long +generic_get_unmapped_area(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags); +unsigned long +generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags); #else static inline void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) {} diff --git a/mm/mmap.c b/mm/mmap.c index bfb0ea164a90..7ac6a07ff382 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2131,10 +2131,10 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) * * This function "knows" that -ENOMEM has the bits set. */ -#ifndef HAVE_ARCH_UNMAPPED_AREA unsigned long -arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) +generic_get_unmapped_area(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma, *prev; @@ -2164,17 +2164,25 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.align_offset = 0; return vm_unmapped_area(&info); } + +#ifndef HAVE_ARCH_UNMAPPED_AREA +unsigned long +arch_get_unmapped_area(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + return generic_get_unmapped_area(filp, addr, len, pgoff, flags); +} #endif /* * This mmap-allocator allocates new areas top-down from below the * stack's low limit (the base): */ -#ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN unsigned long -arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) +generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) { struct vm_area_struct *vma, *prev; struct mm_struct *mm = current->mm; @@ -2222,6 +2230,15 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, return addr; } + +#ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN +unsigned long +arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + return generic_get_unmapped_area_topdown(filp, addr, len, pgoff, flags); +} #endif unsigned long From patchwork Fri Dec 17 10:27:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684205 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 41C54C433F5 for ; Fri, 17 Dec 2021 10:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0120E6B0075; Fri, 17 Dec 2021 05:27:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F03D06B0078; Fri, 17 Dec 2021 05:27:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA5756B007B; Fri, 17 Dec 2021 05:27:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id CCF826B0075 for ; Fri, 17 Dec 2021 05:27:35 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9991D8249980 for ; Fri, 17 Dec 2021 10:27:25 +0000 (UTC) X-FDA: 78926909250.15.0B5A2F9 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120050.outbound.protection.outlook.com [40.107.12.50]) by imf31.hostedemail.com (Postfix) with ESMTP id 49DA620018 for ; Fri, 17 Dec 2021 10:27:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RTvuZBdgF1bmvi7jyoOaXHXUj1h38PwbrFiPhPJw31kKP67692HnhmrmrbvRRDIRDYRkKZWShvraX4D+VJU0VaDJIltj9PAyxNInz/dISOjCMOis0XPts/rmy0/aNNSliDLgeCcN0Pwxwazt19GQuENv39vUiqouohJxGoSyqc3vS/TqJK6Lmclg8G9PMRFat/5F5XhQAz1Jy1KVCHDSYHQc/jcknF1mqTdPqYh1Sq58wT7izPeW9p9kIaTd97xPv5THV4Eb2FTlZP3kXnWCc8qkwaYpzx98zZ39gqR1qDYHkClSX+0xWjBBhz/3VlI8upJp9qntFG9AiZhw+bYouQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cTERt43G9m2uJJNAlF7KkdC0KdJNsGFgPorLCL37J3Y=; b=jOmnCa3g1FdInejB2w8xUAB/yzrhZm4hBX6Q9sIJuDLdGySG5O6kfteYdPK+tfCHyWJ4/BtJVyFPLG/3UoJ4zxXGvQNEXAfY7ivQVLYN7K6Mr0G4AzcYp0PeVYkMSQY5/gwTiMnLJ7Z4KdMJ/Og0ejlTCFIjR42iONl+pbGJLLAtUZoZMJl74p69CtH3WQLzbTg1vpNxAY3zSw8tSJ6NjUiIuI4rXj5oUPzmk5uk5P8l8Y6ETkzR7QHenMkaUy5Bimyk+m3v2HvOvkN+sTNPw68rLHVP3cRs6D7HXe3GlSLOJ9Xz95fvhXH3QgLSKRwhCqNoINrT6WlPZ9OGA7ySsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR1P264MB1650.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:23 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:23 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Steve Capper Subject: [PATCH v6 03/14] mm: Add len and flags parameters to arch_get_mmap_end() Thread-Topic: [PATCH v6 03/14] mm: Add len and flags parameters to arch_get_mmap_end() Thread-Index: AQHX8zCug9Al1NjshECzrepieAu4HQ== Date: Fri, 17 Dec 2021 10:27:23 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 43e8fe8b-ef64-4b6d-90d0-08d9c147d08b x-ms-traffictypediagnostic: MR1P264MB1650:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3173; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hHhF8a5ylLo81uJu1SGkUHg02TtBfQLZWcl8OiIZIcFgoXmR1PsX6Dqh36zwuC31OwPMoQYA0GKWyuXQvuVwt5zQlnkkc3nbz6BMScZ9aloIUnrXcxeBZYtyXbNM/J1bdGC2WPgT6VIPhm8JDaghMxqveV9ZragvxK0DBwVyo3z8S/pJNf3YUWW5c82NiHjge/dQQVZhD6SzHZ48CG5Qs9I7OpZYwYlNz7i9DhZ4DERj6E1HSCuFM6pQkmb+hi/XFlATLAhXVyIY+PC4QTSYRf+p09zwYuN6qB0D2TGloF3jQAv62bXIiZYCWC7QkLnFWxd6AYGGA42oPg/Lmhp3YySxaiPpukR6Jm3jS+lEliXCMBNVMJje3lg/8aa5lTvR3X3hrrC8ENdyvjOj/XSWKRWUfglP+6MGBSQpukeUdqs5SG+XVmU4rO2pbVzsUzzbG/oTvAgqnsCaqbGj2R3+apIYFZxneVMV621auIIxwOzYCO270VYL1HaRLESjwFbuZiEwnK8+v2ITcPGnmCMT7FkJ9XJ9SzQROlieu6L7Yafm11KYGu8xDIEd443PPcM1NZsfBh05boDq8lzG/SqTGAW0ad0MJBXHU2VPQbaGemqHWeWekoNoLIsLKKTnijJzfXakKXviDB4oxxcIDf6TjVEfG/guM/opFNhRC8FBI69lTDK5127+dY1lXDHVSGwCrj834zjKZkiFuPpAzJAJ9A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(8936002)(2906002)(6486002)(6512007)(8676002)(83380400001)(122000001)(36756003)(6506007)(186003)(86362001)(26005)(38070700005)(44832011)(76116006)(66476007)(64756008)(66556008)(5660300002)(38100700002)(66446008)(2616005)(91956017)(66946007)(4326008)(508600001)(316002)(71200400001)(54906003)(7416002)(110136005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?8fcN8mk6axdmZDdOKiDuZOD?= =?iso-8859-1?q?gR/g98aghYInV369OUCW/FvQz/obvVmZdfVVBf41DY9c+TsaFHH71d5uNF2l?= =?iso-8859-1?q?HSr2Tq71VDsPdPazCzNLxazqC0EJe/KM1jNtGtUjEqlLSC7xMeJXrvJILlAX?= =?iso-8859-1?q?1PWgV3OG+2L2IqZD8GDc1poGR7SvJ223VliBvZ24s0DoNaGNmV9zv5HITQQB?= =?iso-8859-1?q?WJ6afV+yJ6iEEH/4YLdmCMGhZ5Zw7u30i1fJSUK/5VGuBSTPzr9hJ17dq3FR?= =?iso-8859-1?q?/f+I5LTpA800evhd00iwR+3E48g6b+cS06/d1u+fJdfIi8zfFHWN0hD+J4mV?= =?iso-8859-1?q?H6qjcM2Xu9doKIZTMAjGOvGyZQmJDALeWtJxpH2se+0XlGok/GpsW65bSt0m?= =?iso-8859-1?q?ZFxLkAFcS4bOoxkezBtJvzoJO7JF2om0cIBEfps8k3QdqaaGUFGlFTAvvVJh?= =?iso-8859-1?q?xV/DX70pUYuky+Mt14X0H/Tumy/rM7SwqerruSJwOlNBcNW078vUAkmWDjLd?= =?iso-8859-1?q?KVVLTMWfJtsIMOAmAC/uquGP2xfhCtex6btQ6/pbT4e8E7DbwvwE51S/4tIy?= =?iso-8859-1?q?L/RFPqbzg5QjW2yJyUo8CD1kvEbSVT+c+CeUmye/tr/L3TRnDAogTiFIKYLr?= =?iso-8859-1?q?Pgj1HBZ4RJ7mJPD6JDmXZljFkg5IFncP4XOg2Jvt41xZ1CE2JaIoSRHX1uDH?= =?iso-8859-1?q?EPs9Eglqnuw7dwi33u0V9rMEF0ZYh+na3WbxAXUH6UqC9b5N+/R701zGliT3?= =?iso-8859-1?q?66Xr+hgLmYT1SVSeJOWs585G2XYqEaFk0QTp48wSZz86j1GkytJBdVOW7E6Z?= =?iso-8859-1?q?nZMaVPh4SsY621WW7ay6EUHHHv44DwrOvMfa0S3UzC4DnKrcddEI0iQN9dqJ?= =?iso-8859-1?q?pbaJtxXQ/Pyi1S6DvtZI4KT6cNLrquDbdTwAJSEyVLqiuGXUAZWHIJ6VLAZR?= =?iso-8859-1?q?irmoSjHtZ4HdJRuqX98mXWnBvheNqdvDALnMQVPas/NLgJF1tXpS05gYt4MB?= =?iso-8859-1?q?SAF+0pjxMqgBHWhIpwbTzmzI4TMbBFnaMnQeX6VWLH7A6LKpyhsmqm/7jbVB?= =?iso-8859-1?q?Ir2xbZYDggMPelBo1g80CgU8GQCuC6xqfZn6lLmKAzasnlxgdzevpFXH14wK?= =?iso-8859-1?q?VRQGM346LxQczASi1QtqTs6I6yGcOenncPi7d890v4mDPSQ5qTl2EvAJMt+z?= =?iso-8859-1?q?Xb9ynLyxy+z9DYzTTyJT+1c+hWWcVrid85ACLzbK70N7Ba/qjxBH1zIRwipW?= =?iso-8859-1?q?97UQPvWWlpyGe4b65DsYhdQRwpCat2jYFuCg94VMr2OfqtSkUBWgaaOUJj/a?= =?iso-8859-1?q?AbXLJtSiv/TX6SsB9mcf/wdt6P0Lxguab/Fohx+KgUZKUt+3JRdirfXJSum7?= =?iso-8859-1?q?YOTvW/3je9cAVwvtUCZnxjNX7Y/8Qex3wlGay68DToBs37KdrM481MKBZJRI?= =?iso-8859-1?q?vRNyQEM3TmM/hIFhh+o0rk6Zbw7Ez54O76s3IKSctVhncWMAdLqecbORVWgT?= =?iso-8859-1?q?wao01dqbMaML2MDPcrabeeYi2UYgBrwfMM21PgZ0vX9jEanoAm3Tyv0Y2L8X?= =?iso-8859-1?q?GwXdIjUZAM2HurTkdd/dlDBtSfx0iPhPl+At/pp7rU/PxTmzXZQWXRSCJM57?= =?iso-8859-1?q?ZTBkaDpBu+SiOkf9fE3liLO4/L2PhbUFldG6ZugOy/ESD7R248qiuCtVj+gK?= =?iso-8859-1?q?S7hbPlFr+WYtqWJvkO6BMDuA8kMn7Z/4bJ3Bppw8K3MwRjGMfduPGATRUCPe?= =?iso-8859-1?q?R7L4=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 43e8fe8b-ef64-4b6d-90d0-08d9c147d08b X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:23.4657 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yP6HFKBal8VhpPEnUhj/awG9cBDIE2fU9tecV4VJCDcA0Z5Dh7JQO0cixc9tR4s3w9S4We61XQ3D0RqM/TTclyPTQ319XYOlfz/HWO+dTl0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1650 X-Rspamd-Queue-Id: 49DA620018 X-Stat-Signature: jaquisui7u39k47zaf4r9z9pzncbf8ro Authentication-Results: imf31.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf31.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.50 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam11 X-HE-Tag: 1639736837-386273 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: Powerpc needs flags and len to make decision on arch_get_mmap_end(). So add them as parameters to arch_get_mmap_end(). Signed-off-by: Christophe Leroy Cc: Steve Capper Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas --- arch/arm64/include/asm/processor.h | 4 ++-- mm/mmap.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 6f41b65f9962..88c696350ace 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -91,8 +91,8 @@ #endif /* CONFIG_COMPAT */ #ifndef CONFIG_ARM64_FORCE_52BIT -#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\ - DEFAULT_MAP_WINDOW) +#define arch_get_mmap_end(addr, len, flags) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\ + DEFAULT_MAP_WINDOW) #define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \ base + TASK_SIZE - DEFAULT_MAP_WINDOW :\ diff --git a/mm/mmap.c b/mm/mmap.c index 7ac6a07ff382..ad48f7af7511 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2113,7 +2113,7 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) } #ifndef arch_get_mmap_end -#define arch_get_mmap_end(addr) (TASK_SIZE) +#define arch_get_mmap_end(addr, len, flags) (TASK_SIZE) #endif #ifndef arch_get_mmap_base @@ -2139,7 +2139,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr, struct mm_struct *mm = current->mm; struct vm_area_struct *vma, *prev; struct vm_unmapped_area_info info; - const unsigned long mmap_end = arch_get_mmap_end(addr); + const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags); if (len > mmap_end - mmap_min_addr) return -ENOMEM; @@ -2187,7 +2187,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, struct vm_area_struct *vma, *prev; struct mm_struct *mm = current->mm; struct vm_unmapped_area_info info; - const unsigned long mmap_end = arch_get_mmap_end(addr); + const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags); /* requested length too big for entire address space */ if (len > mmap_end - mmap_min_addr) From patchwork Fri Dec 17 10:27:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684207 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 D6A0FC433F5 for ; Fri, 17 Dec 2021 10:29:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BF156B0078; Fri, 17 Dec 2021 05:27:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16F3B6B007B; Fri, 17 Dec 2021 05:27:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2B186B007D; Fri, 17 Dec 2021 05:27:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id E58C56B0078 for ; Fri, 17 Dec 2021 05:27:40 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A8E0482499B9 for ; Fri, 17 Dec 2021 10:27:30 +0000 (UTC) X-FDA: 78926909460.22.864219E Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120050.outbound.protection.outlook.com [40.107.12.50]) by imf23.hostedemail.com (Postfix) with ESMTP id 55BAC14000E for ; Fri, 17 Dec 2021 10:27:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iB89JXApPwuwCFDgBvf/poPk3XsHOPuJmLHy4v3THlnicUX1+qJP+ioQONgSdwuAhEzgY6efLy7DpNMGu5R1miLbB/nmkV57tci4bsU7tk4NSaXMMmSHT8LipBN/oyxzopiDaPnfVGJVwcNA5yL9nIkZMdz/OizhAXEOKht+SnqpBOP4wLEuFsuSMXMSN98LI9aVwOBYxm1A0WaPW7aa8sq8/iWARp5K33s5MvP9PEkGat9Kt9JA0RL5ABb90FDU3oNUZZKNIACKXmt80JYUTf0DAOsGpTXfKOTP7R1RdUDai4xGyrXfkw86/mK43KYKrhzI9MivKWMtetG1GLoaJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zGuchkW6gN8DyiSjcCAMN3uQCynPaUaD4ighWhH83D8=; b=C4ypQdFeDDhd3tJJCGb2Byx0l4zNja9recLA221xkLXU4J08RLBynCfZwewChZ8/hIRJhSr5bN80eZoSpe0I1yhqAuWmhbuWavTlvQ4WUQq2s852l7cADH0WFVyW8F5K5ChAWh2FiMX3xqXX5VN2bi7WoEAdppTDybyyGLkbGTqSms4BvmEAAjnat9Q1fnyRMkxAizaxrfL5hlEI2P2700t6d1X2Xi482Lvw3a1NGe0AI+tGBQTzZKiLX440depQxb4FeJ/hh72lFGi+2Uf2hB6VuIIuCPRaLJoEJke/hrfHVL3Q0gkNfoFYqd8xSM2KGGQ1tRgi+6Bs1xAhShqL+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR1P264MB1650.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:28 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:28 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Steve Capper , Will Deacon Subject: [PATCH v6 04/14] mm, hugetlbfs: Allow for "high" userspace addresses Thread-Topic: [PATCH v6 04/14] mm, hugetlbfs: Allow for "high" userspace addresses Thread-Index: AQHX8zCw1U4oSg0lTUqR0a0vDc8DCQ== Date: Fri, 17 Dec 2021 10:27:28 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a78978f1-f292-4da2-fb1c-08d9c147d369 x-ms-traffictypediagnostic: MR1P264MB1650:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /+kmlVvERmbbsL6d+X62OmM18OEW7mlhR5Gs0qIFUdqX+duVpsLyap/pLCNlaLPdq6+WapP1mpOFhQjzNJa0ZtqLj8m3IiBkIHrpL1fm6nRzClFkmNoi3oCEpqpHTwL85siyj7So4TIAp3f6KOHdmKg+6yjVo1/P/VrOVznT+yvVnJb6nZrYEsq6Wf0+pofBgUaBvEd3jrYyq8jc8mj+jbRedPMAAFagtxtqEgQRKHjNQX6GityqGdZETU1H0L9mduxJHc28SLi13e8LXKRoFutMolRzDrzapd6DlVFCKe+ufKG2r6Eu6CF5Cb4PjwEBU29I/9OkpYezd2YbUD2GYNpf2u3Oy6Ltxh1+XhoRUoMDCNpDTkLdmIMKLn0JxhQ2+YB/YLGO7At8jnCooUx3pK9/J1FLhuTx+kIDYnhCsA8fFZ9C7si6dgpHN/OxHkJWWaYsDj5V1fhL+xpUjcuckzk/UUBuhcJeUPPveqMnpEVSNN5y7Bq7IVNSaBSz7HrTWX6XQnd0upxjs9tEUBJN2aPAJZyh3jrNchkjfDJAByLDfa+AKYJ0UvkF7ngPQJOaXCaYZ7GCh7PqU9zq68b2S8elRYvRZOXWmdMz9YhiImJDP8LEbKp+0Ap7XNbSgpqdp3K3UVkm4Qes/y6E6rVzb6jmXS8QsE7IpSm8VHFk+dUDPL0Q0Y2IaYm40vsR0NTdPCMMo8fKFlTcbWiH6WN3Nw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(8936002)(2906002)(6486002)(6512007)(8676002)(83380400001)(122000001)(36756003)(6506007)(186003)(86362001)(26005)(38070700005)(44832011)(76116006)(66476007)(64756008)(66556008)(5660300002)(38100700002)(66446008)(2616005)(91956017)(66946007)(4326008)(508600001)(316002)(71200400001)(54906003)(7416002)(110136005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?OT1OVswMaI4vEOeEsTTFAbp?= =?iso-8859-1?q?vijDWfVCm6MjHbMf87WGhmwpC4R6sXImDk5SuOeHbV062Rt8GueHTmUczHSI?= =?iso-8859-1?q?05G2pcCMpyQQNeEB0uhsGPQVwST9iUS1ew59A9dDQobbQIV8RsTHKfDWcgFj?= =?iso-8859-1?q?2X6Sni/eFiGBCRRMHFpC0RdJmPn76iiSF/pmMe3j0GCLuzxnZ27yFf5Rn8Ux?= =?iso-8859-1?q?xU6yGAf2WfdJ6PpQ8H07XNqIAZjwuhTO83x287/56vFoE6nY7+QiDnLUHcJG?= =?iso-8859-1?q?u+8grVrNp6h+I4SH1LYb7NrBzPMdoJR32HLUERna0UOm/4hoXxulRNdUv3cV?= =?iso-8859-1?q?XWslvira+9S6hqb9h2WwR0xoh0AFp/wUAHIcXmsU1fyU1fo+z61ifDIufttE?= =?iso-8859-1?q?kTnyibw2My1gDHBS1Jo/734nkTG8OGEvX0ao7Fr4dT6faLupwyCBOM4E31MT?= =?iso-8859-1?q?Rv/ZZqhwfZonNiX+gcLhWrR6TTCoCPMkKvoP33Oz/gyv8nJfiRZxVrnBQ+SH?= =?iso-8859-1?q?f2vq0O70fR77QfERCrmQSWa8fDhu4nE9iYppRni2JABckddtOkHXlRN79QQB?= =?iso-8859-1?q?5MeqKn5zamLCDb5GUT9j/gO3Krn/Iu6lM62NUH/DDxe/WYI2RE02/vxiLey+?= =?iso-8859-1?q?8LmXjjlIylj1IEdoyxFIiZDmv8051xtZALFpA/jlJ+h6KGKAABlOgDnYS09S?= =?iso-8859-1?q?TMETZpHSxzWaXtvPerIkXuk96dEFcOHnecOn+vbqAMiYlGPFcvKM0xNz5LSG?= =?iso-8859-1?q?WszU2XrsUvBt9DVZXLDEhJHdnbqUmSfaXdKTydBeDgmAtOQDEVq/kkwmg/i/?= =?iso-8859-1?q?kbQxxd9JJLUlbWngrWjbjLNx91f1ZjM3143v2pfMNPrq1Ta9w5q7dbYUjSn2?= =?iso-8859-1?q?cDDiQdJtw2cjHfJizeuQpQFD1L/HY92NhERRuTxQlOYCz7Mjhu2NjxP6OoNp?= =?iso-8859-1?q?qqJSUSu+NULFkSOOZhRLyy5PKFsfTzwzpwaxB/qgIzRB47y0lcIemJtwbhDh?= =?iso-8859-1?q?nYdxeNicqYVEUrcK5odeXmSVCavr6xQOGiP4oAaAfeK876M4RFtTikxNQLNs?= =?iso-8859-1?q?0BVgqSKYxb3WkJmzpRmtv+2ps2ZLWy65jhLamJUXbX63Gwh/WGeXxmgeOFjA?= =?iso-8859-1?q?wfv7xvbqU+l+wbyM8J9wBb+I46weC9sVvDZH61Xipsd78RBTJudvTWzLhg1c?= =?iso-8859-1?q?4082xohqjmHkazMKyjaATfnRyafQhJsniZMrr+9h3FJZiSZf0jXfNGJSpOuy?= =?iso-8859-1?q?EVO5+iw0A6ubzYZZmneKL+U2R5r/nwL8sT9b5QSOUe1PzDEafJuc1Ke9pxxm?= =?iso-8859-1?q?YzLeQCoktdqUIKvAY9FKzrdztZEgjUSZVliap/ER3cJbThyXc7Zxam868IIG?= =?iso-8859-1?q?Gp0V6g7rd5iAG8kcA32g8jgvomiqvlsxARN+tgILTk1pL1Pv+iunsIk2K6U6?= =?iso-8859-1?q?+zm9zsHs9QyvduFKtLCNHTqyKDQARu7BN3nBfjH0vzu3deeOK3aq8H0mLwIQ?= =?iso-8859-1?q?8Pwt62aaW9/FhNgBwWiYAjN41SZOPx7U72xIpTyN91RL3SHkYAoDL4Qsf80R?= =?iso-8859-1?q?HiPVnRkTubkH72Tu43LhpCBrmqJhim6ScZQSz3fGhuThVwlCV0ntFumRzKLD?= =?iso-8859-1?q?2AJRMx4TnULy1NOrpLnWq+dtVmC5FHLr4fZIYekTySFUK01G2WpPTMCHSNF4?= =?iso-8859-1?q?kpyVD2srn+jlF5omRLDOyjjGxnY4EIgxCQQnyh6VMtn6LW6OCnlw2nlkmBoN?= =?iso-8859-1?q?IQh4=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: a78978f1-f292-4da2-fb1c-08d9c147d369 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:28.2944 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: s3WIFI/tuDHH+/EAa8AyKUz+El75Yb4VJfHu8icu90uRrU1PSb6itzvlyoxtT/tK6KwIrsu0lh92DBo2bSg+LxJ+UFs2teNCrHRx9crF+2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1650 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 55BAC14000E X-Stat-Signature: fiwtd8zf96oewmmtegb4s48mkfnf5c17 Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.50 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1639736845-192909 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 is a complement of f6795053dac8 ("mm: mmap: Allow for "high" userspace addresses") for hugetlb. This patch adds support for "high" userspace addresses that are optionally supported on the system and have to be requested via a hint mechanism ("high" addr parameter to mmap). Architectures such as powerpc and x86 achieve this by making changes to their architectural versions of hugetlb_get_unmapped_area() function. However, arm64 uses the generic version of that function. So take into account arch_get_mmap_base() and arch_get_mmap_end() in hugetlb_get_unmapped_area(). To allow that, move those two macros out of mm/mmap.c into include/linux/sched/mm.h If these macros are not defined in architectural code then they default to (TASK_SIZE) and (base) so should not introduce any behavioural changes to architectures that do not define them. For the time being, only ARM64 is affected by this change. Signed-off-by: Christophe Leroy Cc: Steve Capper Cc: Will Deacon Cc: Catalin Marinas Reviewed-by: Catalin Marinas --- fs/hugetlbfs/inode.c | 9 +++++---- include/linux/sched/mm.h | 8 ++++++++ mm/mmap.c | 8 -------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index c7cde4e5924d..a8d3b0899b60 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -205,7 +205,7 @@ hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr, info.flags = 0; info.length = len; info.low_limit = current->mm->mmap_base; - info.high_limit = TASK_SIZE; + info.high_limit = arch_get_mmap_end(addr, len, flags); info.align_mask = PAGE_MASK & ~huge_page_mask(h); info.align_offset = 0; return vm_unmapped_area(&info); @@ -221,7 +221,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr, info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; info.low_limit = max(PAGE_SIZE, mmap_min_addr); - info.high_limit = current->mm->mmap_base; + info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base); info.align_mask = PAGE_MASK & ~huge_page_mask(h); info.align_offset = 0; addr = vm_unmapped_area(&info); @@ -236,7 +236,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr, VM_BUG_ON(addr != -ENOMEM); info.flags = 0; info.low_limit = current->mm->mmap_base; - info.high_limit = TASK_SIZE; + info.high_limit = arch_get_mmap_end(addr, len, flags); addr = vm_unmapped_area(&info); } @@ -251,6 +251,7 @@ generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr, struct mm_struct *mm = current->mm; struct vm_area_struct *vma; struct hstate *h = hstate_file(file); + const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags); if (len & ~huge_page_mask(h)) return -EINVAL; @@ -266,7 +267,7 @@ generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr, if (addr) { addr = ALIGN(addr, huge_page_size(h)); vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && + if (mmap_end - len >= addr && (!vma || addr + len <= vm_start_gap(vma))) return addr; } diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 2584f7c13f69..cc9d80bd36d5 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -135,6 +135,14 @@ static inline void mm_update_next_owner(struct mm_struct *mm) #endif /* CONFIG_MEMCG */ #ifdef CONFIG_MMU +#ifndef arch_get_mmap_end +#define arch_get_mmap_end(addr, len, flags) (TASK_SIZE) +#endif + +#ifndef arch_get_mmap_base +#define arch_get_mmap_base(addr, base) (base) +#endif + extern void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack); extern unsigned long diff --git a/mm/mmap.c b/mm/mmap.c index ad48f7af7511..c773b5ad9a11 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2112,14 +2112,6 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) return addr; } -#ifndef arch_get_mmap_end -#define arch_get_mmap_end(addr, len, flags) (TASK_SIZE) -#endif - -#ifndef arch_get_mmap_base -#define arch_get_mmap_base(addr, base) (base) -#endif - /* Get an address range which is currently unmapped. * For shmat() with addr=0. * From patchwork Fri Dec 17 10:27:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684209 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 13A33C433EF for ; Fri, 17 Dec 2021 10:30:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 569906B007B; Fri, 17 Dec 2021 05:27:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 519186B007D; Fri, 17 Dec 2021 05:27:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E0556B007E; Fri, 17 Dec 2021 05:27:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 2FD626B007B for ; Fri, 17 Dec 2021 05:27:47 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EAC31181AC9C6 for ; Fri, 17 Dec 2021 10:27:36 +0000 (UTC) X-FDA: 78926909712.18.0B12216 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90072.outbound.protection.outlook.com [40.107.9.72]) by imf30.hostedemail.com (Postfix) with ESMTP id 5BAAE80011 for ; Fri, 17 Dec 2021 10:27:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fTa5D0z+VKJbV0fqCnhmV5uVHNl1aPBOfL9nAvmhJiC6JECosrveVSKd+OQvxNcjFixB4p7hPTKpWGrJFKhNmuqCd3FncRAOgXS1ILCB/s0zPoPILY//S4LRWcwuh5JCBvrLQu3HJH217Gr6h/rzixpENUWHcMPdd8dgErCJFZCKlaqIP6Xk2RqPTnW5a5DSQptyLQpwBa994wLZC7/Auj3ubl6oiRDInacX54EBZniPij0geLgT4ml2DsPD8yf+jZ8EEZ81ILd+9rRHW3UJ66m64iAwzR5mZFSC9x1ODpsKPQB3BJVIYUkVYIeYLIGpSM2z83tBeR7t0U3wyL0w5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BMqQpMVPJWiGmTGtq2QUJHhfhL+o8r8GMswJlhxDXUU=; b=RPFAEwgr4TGjHk+GiQ9VpWQ2sSRkILP6FM7jeAroCZM915gpJaPXkcDet3HPs9UQhYvXCl/28lVtSJHhBDzq7KsYRtumEBV0pZBKMAl/NS6IQxGNvkq2zFXbBaJrn7QLWMoPGm3unHc1MS/SbC2YoqLcY4KcqDuDpolFeioP/dUdtdB5cEqW0icij8wcE9rwMIHDgJd8KqtX3yPXU1xDXqjgykSeyKWcXTUKezDT70dg9pdgt6mURQrT3YXTMZeBDGWnKV1W6zjht2QUOKUegWCTc/HpwSqcn8TA55EkqtWVZ72B5d/6vdW8BP7DvGeC+hrkV68p2V2a9wmtO6Xogw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0194.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:33 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:33 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Toan Le , "linux-pci@vger.kernel.org" , =?utf-8?q?Krzyszto?= =?utf-8?q?f_Wilczy=C5=84ski?= , Bjorn Helgaas Subject: [PATCH v6 05/14] sizes.h: Add SZ_1T macro Thread-Topic: [PATCH v6 05/14] sizes.h: Add SZ_1T macro Thread-Index: AQHX8zC07qMBhzOyKkm4HzYDjm34Jg== Date: Fri, 17 Dec 2021 10:27:33 +0000 Message-ID: <94272ef87ad071d6d11e20bc5249608012714613.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ec3499e0-e8bb-4fa7-77b1-08d9c147d697 x-ms-traffictypediagnostic: MR2P264MB0194:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:639; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QXqZIp/tz7ghfLES5BumSHj6rEaaKbSVCt/BWJubkEvOPRqSxjg1icGsK9qOrqO4a+dNGtgFzBRkyeLtrOr3fQvYS5zhel4DBhiztb85x8fPIjBqqNzLybIg2YYumtIdUZyU3tpZqXg3qo1fMiFM/+urJ+bhO6EOodFy2zbeU23Gh15V749Ot9/gUcc9TWRcDnJ91Ojz6zw0Ji2VKnkeZH8LvwIkg1H1XH//Mh7MfL1FTwhWgRWtZ+vR6j0bddoFrTd9/l0FH8XAq2eklyK0jMcCg7LpqR57uz00x4lx6jK2as7YluOeq3weJNyTaz8XF8r7Hsu59v400G3STWcNwNmca+VHhqlpxZMd9wjp1bgE0oyaR6Se8ZRLZjkHoq+Cgs4Hlh+4Gng4jbLpOiQRzbOLdHscOAHQuyEYUoRKnY4xwk1wcamjHNq2BEJM/j97V+xBiC60G6DQT9wb8EygXen6j5SaSkxPWF03yqY4F6dTie1z/MghNJf6c/zDn4P3d0sdtGLPLmdrTFy+m/hW7OkR6aFYpSr/fi7dswUCFxFUibNB0FsZawP4zT/RKpNozEP6s0vklQWsfKH0meswkqzIZsgfUo+me1v5gF6SSWDMb46tWJhUHZ1p0ocG+loJxkZSRZdP8j7Trthu/KX1rSRE8nr0HKhrI8vyHehhC/MBasLLSyRBixYWwzAShp30RlVj6qO/8MJSOyCDgIfDMg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(122000001)(2906002)(66476007)(66556008)(7416002)(36756003)(316002)(38100700002)(186003)(44832011)(6506007)(66946007)(91956017)(6486002)(26005)(508600001)(4326008)(76116006)(2616005)(8676002)(8936002)(66574015)(66446008)(71200400001)(83380400001)(110136005)(64756008)(38070700005)(6512007)(54906003)(5660300002)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?rkxnGCS3ZJlCXYYg23IC2xSl9qPA?= =?utf-8?q?IKYQ8SwA42iG//igRnatIT9zwkdcrBnJOH9UweLtsN+ZzxR4+FSMR5h0FZoMUaLkx?= =?utf-8?q?3jmBgIlMJh9Kc8DBvNhwPcRnprnKHlbNyHXQcw4CgFkK4GEDxvP7hESbV9yeO9OV8?= =?utf-8?q?wkZVKoG/DqJjIkb/ExeNpUCDogRkfogFntcbjokCb/QXYj//8EYvQ2F0SrncR6jph?= =?utf-8?q?35+dm3Wf3sba6K/Ic2jCsOEjMZweAiBfBwUzK6AvNy+kriDQ2Onj8NvINBFgt/CzW?= =?utf-8?q?Nt2gIhCNbiEt1SfOtJrV8pTi/5Dc3bIIGdWU0F6baqldyHs9VzYLWgmSrxvJcsFPb?= =?utf-8?q?QJ3N9wUv5SD8vMiajCmqPHF9xdDjDSSxZunkXXJbb26/3wuHC9ZyyBEriTy+YYIG8?= =?utf-8?q?6wRgjApyMnyd2VCBi85iovUNOwzwa9p0imqMDFx2DplYlq5tEwNHGiNDrl0M0mJDN?= =?utf-8?q?jFzYjhjhhGizKeSq46j6Zk2x4jujAerYcco8kOR6P6p3zW/hfpgi2+b5E778WIlbt?= =?utf-8?q?TR179Zt36P+CP8LxEcxYpSVtrlYoALEGCd7VLFAGkX+qumBgpLeFiHzucMYniYPEc?= =?utf-8?q?NPisDzoWad3WsPMmSOaM7T6IeOJ+8kZ+TvUB+kT3O4AqYmPNMWS2BEF9Ttd2PQHbq?= =?utf-8?q?l8He5cO57fdWme/26VjitPXmkSttRwXciqKduIV2E7Q4GITyvQsYQFFLGp2ItzRlp?= =?utf-8?q?uBdTtTtUe2I7muzsxobrK8sM+MO7S4XtX8xueywUxkSF+PNWbVR9dUkmgdA+hIbVc?= =?utf-8?q?6z4Ngpd/i/19+pK9Hc3XzOxtGNhTf46Jd0Rgz9c5QXeG0U/3xRurlR33gqjqB5dsd?= =?utf-8?q?pujFVJB4rVWZpuFwFiB7AIGGhqJiNJ1kRAoChqhRxj4WXZEGayN5WBKW8J0BgvkzM?= =?utf-8?q?LhcSyR2chRVMdBNjWWDDEj3defOqDp9XE7bHbQSB+KIPGuecRw4IA+MQ8Rya75ILN?= =?utf-8?q?NUWpXBIwQfSeq4ARC/qYHKtYhoFeIJFCf1voGxUJKGkdVNiUMzWVcU6Fina2T7gh1?= =?utf-8?q?aVtxh/e9cbqi3wFGd2rIQAP2CnTbaZkjFkNvBUre9hGBIu0rlH6OFWf5TEFD7Xofr?= =?utf-8?q?Ik0OzNbpWT1R2LuyJK7TRTkOmQofEgbBBlvvrJGetPN+Loh5ts+/f3lu19gp2BttW?= =?utf-8?q?hKbs1514pUsUd96pW/fkRhsh7IX1DbCG5IkbFGMn/ij19nAvOLebyGJuRke01IqkO?= =?utf-8?q?tjLCmkRqRY/WPs0ULFu0uegHBH01s7ZxU/g+6ANlcED3bN97OymGLCrrjCq74d1DP?= =?utf-8?q?3OUqdnyx/hWGdki1HesqrrgEN/e/NDaYiolMSwOwyo1a92pAiQQvEzZutr/ldTcVV?= =?utf-8?q?NCH+J4db6aWdcM3OmU+n3mk/58VrVNRReU1DVBcxpDYL6LASRjCmeyPVVZxWezTMd?= =?utf-8?q?XBDgdXjV3NZ/gj6D3H2oag77Dxpo1gNO7eGoCdsSwhfsiJqdWHBImyTWE67KhjT/D?= =?utf-8?q?ZJkizLr9xnLXfMHenn6mT+Ae2SoCBlgzOWsXChm2xnDdLms9igifkM25ojq1wvShC?= =?utf-8?q?6Cr01IoLnZt15Yynyoza8Lwi2z+u1Cy6zd+rI1ZlCZ4jKQALlfNSOJGbVozhOlN/H?= =?utf-8?q?AEcMLxUmtElm3gS+5g6cZ9oAr5vJbqeGteKUlFKrfV3nJtyZzIzYOo=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: ec3499e0-e8bb-4fa7-77b1-08d9c147d697 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:33.5944 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vQsTU+Kvc2ZuvHR/XJoPoyWNv4pI4tpUTaXIJgF8mpcT+eR8EBtXaPuqa7GkjIM5YndhsXpMKCz+o0Tp8qZuapJUn4aHhRR/mh81rdRpLSo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0194 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5BAAE80011 X-Stat-Signature: c9pg93ieo5b5xxeojfwbbxfhg8kzcr36 Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.72 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639736856-775203 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: Today drivers/pci/controller/pci-xgene.c defines SZ_1T Move it into linux/sizes.h so that it can be re-used elsewhere. Cc: Toan Le Cc: linux-pci@vger.kernel.org Signed-off-by: Christophe Leroy Reviewed-by: Krzysztof WilczyƄski Acked-by: Bjorn Helgaas --- drivers/pci/controller/pci-xgene.c | 1 - include/linux/sizes.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c index 56d0d50338c8..716dcab5ca47 100644 --- a/drivers/pci/controller/pci-xgene.c +++ b/drivers/pci/controller/pci-xgene.c @@ -49,7 +49,6 @@ #define EN_REG 0x00000001 #define OB_LO_IO 0x00000002 #define XGENE_PCIE_DEVICEID 0xE004 -#define SZ_1T (SZ_1G*1024ULL) #define PIPE_PHY_RATE_RD(src) ((0xc000 & (u32)(src)) >> 0xe) #define XGENE_V1_PCI_EXP_CAP 0x40 diff --git a/include/linux/sizes.h b/include/linux/sizes.h index 1ac79bcee2bb..84aa448d8bb3 100644 --- a/include/linux/sizes.h +++ b/include/linux/sizes.h @@ -47,6 +47,8 @@ #define SZ_8G _AC(0x200000000, ULL) #define SZ_16G _AC(0x400000000, ULL) #define SZ_32G _AC(0x800000000, ULL) + +#define SZ_1T _AC(0x10000000000, ULL) #define SZ_64T _AC(0x400000000000, ULL) #endif /* __LINUX_SIZES_H__ */ From patchwork Fri Dec 17 10:27:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684211 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 1B342C433F5 for ; Fri, 17 Dec 2021 10:30:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA6606B007D; Fri, 17 Dec 2021 05:27:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D56446B007E; Fri, 17 Dec 2021 05:27:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF6AB6B0080; Fri, 17 Dec 2021 05:27:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id B28326B007D for ; Fri, 17 Dec 2021 05:27:50 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8443F8908A for ; Fri, 17 Dec 2021 10:27:40 +0000 (UTC) X-FDA: 78926909880.23.00735A0 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90045.outbound.protection.outlook.com [40.107.9.45]) by imf19.hostedemail.com (Postfix) with ESMTP id E7F0C1A000B for ; Fri, 17 Dec 2021 10:27:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHPGzv2FR88/XJUOuIU0IbdqkKzNZNz3d8f5rF0sb281LQ0zYquLBx3m4tmtzjPWimFhjvjQ1UIg1zzvjI9qhEbZtgKZto5CnLESDXzZA1oqOl0LiHgtwbJB3vBFIZjYSXeHumaLHinLGtRc9DHkUn+TuNL4qasqFFQtaU6Z5VhDkXsQWGJ/4rGRSINreWo932v1rFD7/fDlPh3kUzOh37rUw4E7NMXPNAZCjHqyBgZhWKwHLN8vetiUkF4guaxOi/RnWCjhsSKklxz55hhSFSP/yqaJmQzmZagHKnOkbBnBA0iD+04ATRfPwC3Zhx7LO2FeRc40aXTM03ZDq1AmPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RiZMm9KXXy+vu3WhUEQeEWc13H9a8TPaQVYGQB2pazk=; b=ku3AgqusDhFMB2IrnUXRWJLCliQ4qWarYufXB7H7g9woXu3laHx02d33tc9EkFQMjQJji5kp0DqXwdLrUoQbd0BHXSVjjv6Vcd7QE9UlsCJmrCKkRksWXIHqP9aSANJ4nl2pd7zhH699OoOJ10xjn3l5udYQ7dgljhmsgnSvmXzE/KuYlZId0Gc4JQsRycJ6SESxpnUGrkzNZ5RUmLqGvtM69B9Gn3nEBc2AP3xXx9VWubRmuFkc7jJNMX+5zxMGotTTgP6dG4dqvwPfFpoSx5/wF8tIEhpfOmof0XkfbzqW8hjf21plUp2gB85XDtaf3Ulqj03fZ+BFCwfzQL3NwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0194.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:38 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:38 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v6 06/14] powerpc/mm: Move vma_mmu_pagesize() Thread-Topic: [PATCH v6 06/14] powerpc/mm: Move vma_mmu_pagesize() Thread-Index: AQHX8zC28dayHdKkFEWOgBWA0YYl1A== Date: Fri, 17 Dec 2021 10:27:38 +0000 Message-ID: <523780f4ba5497efb738f9e25e43f23263e125ec.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5b03f6d4-da12-4bbe-5178-08d9c147d95c x-ms-traffictypediagnostic: MR2P264MB0194:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wUX3LCxBnvwgDSGbyBjVKvmqLBxBM0AdyJ4E2pMORh9fJ6J2kULjLFEffKTKnFapdz1J7SNFhIFYlm/Gq+MqWvtt7Ypmd+/gRpzaVmZwCO3mWSybGAqu7Ds+JxGP8yPIZ4tn36wFYzDJVbJbdSsxfVfdXJAUEta1M48JjS+vmjh3Y6Pzls1N0bssm/Teku04QhME101ZnW4wyiMWSBd3P55QamWkaf/LCQyg0Id+q68aIzEK2cmrMTA0wPG0fwRMKefEfCujIXaeUJM2anad06VJE45sx0YkyqxhbMtuN7+iA8mI9TeODiRu55rU1P2bK+/ER2nWpvCq5/fNBm4T418AMbKacVisXoWs/2dUmAo8Xanp/928246NZq+g3cPn2omULAC8JqETttVk3Xo1t7uU+PJ6EntTs1AjcTTqiPlXCA+2P40FdqDtDN8kI75ovc17uTB4ncZTlvNGjcUAjDq6qarw2OsquBzq8EVXbdlT9HYZzPunWV6zAeetWpTegbXSfXJy8DotTGCHJ8HqBgrsbXcafkrYi21XJCY50PibzG3LU1hYyPiRE0FxBSZbO2BdliaiC0Q9GLYnWhjmNGb/ADquBa9bg7GwMkBCyvc1j5U/6Z/qvSwNdpmA6bjs0gZIh/r3ebH4H2X8YWl/JhOJ2OLHldoQ1bxVlz2VEwS6s2wSr3tjrf5Ht/GuxkakAsv3fDnPUuxOZV96WEjZNg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(122000001)(2906002)(66476007)(66556008)(7416002)(36756003)(316002)(38100700002)(186003)(44832011)(6506007)(66946007)(91956017)(6486002)(26005)(508600001)(4326008)(76116006)(2616005)(8676002)(8936002)(66446008)(71200400001)(83380400001)(110136005)(64756008)(38070700005)(6512007)(54906003)(5660300002)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?HYa0f8vPEkCKHm4QkTbUFNi?= =?iso-8859-1?q?zQS0vRP1F7ULWXgLPI19L81aPzjnfHwojLFLLWtQy9SIWLmdxi1R1Mvi7pZi?= =?iso-8859-1?q?Zs2y2Wg5vZIXiAOu870L1oqN2ocGDbO0P5MIiqqijUT6P+BWaHCWdZjf0eti?= =?iso-8859-1?q?6Y+5fWDLPXVd8UTBQ9w/D28Atr3h6xM8hM+8p7ykmraioR8k2+y2piDADfcE?= =?iso-8859-1?q?L0dvV+aDBzv8pdsyXuY5G7burMJWbCYmF0w8a5shQ4dpIiG0qU4xbZ+VJ01K?= =?iso-8859-1?q?wdTFdUOnBvSoN2Upj53PCdt5yyNhhJwxJc5Kw95nzswO5SzBjWAP78TYARnq?= =?iso-8859-1?q?nUpnjBIvFHGrNX5JlIJppgd8ymfdkOrOxVyaT91srt57eUnIRPuU4yp2IH8b?= =?iso-8859-1?q?XkJ5le0J7gdMKNlunTGX3o0DFynFpSvE1gutXp4hHGLRt0phlEEHSc3rewwv?= =?iso-8859-1?q?d8ThqLB5sxevlLfBL2rdWLBNJmzU/ceHnZlP69WlEaiTiQlpTAuxD5c8vZ/I?= =?iso-8859-1?q?mT/cmqxnwIRh5DJqzrW/A+nKA8PNRFFSmZbqry1+LZoNK4G5oC7nWD8kD8Y9?= =?iso-8859-1?q?50PsAurqkxCI7cFtDEdbNK2oI3wxatYiW2vQ4D6hOroqjtA9pk+uLmSoUR7f?= =?iso-8859-1?q?5vHaWQct4pskIa3/5bPlEoHYfO1h5VO2seO/+3QQBUwK5MjaNQoEscdu80v8?= =?iso-8859-1?q?2zEhWJ1dijMqaLWlafIP0GxbTUyzt4REJE1FyFKPy4wUJLB2Y6MHZLjI5olH?= =?iso-8859-1?q?ugNR4mxcfD+f3s5wNa60YF1yZlg1rihsVKuYRDQSyUgHAGAsHK/MQkcTXHDh?= =?iso-8859-1?q?GObsTwFyXXJ5yMyW/F1GD2acRT81e5ieyRdykxaP+nROiZNg7ruSC6RS/ZOc?= =?iso-8859-1?q?UFFxH6GZKTyZKTXP23TINZ0IqJsIb7/6wWipuP8WxSTb7NQTe0KwoziPu3Ha?= =?iso-8859-1?q?8QfFEMStUTfEtCoA+OsAEDlKGZxgMaSi0J6UWPfB+qK3LLmHgGsomMrQSbYP?= =?iso-8859-1?q?ktPqT3YzPkgB8c2xKA3D5dTYc/Gyr9WYNkiV7gGKHp1gdDnmk1adB+qKG1nX?= =?iso-8859-1?q?m4MGRy5CmeED3ssv+W1DBj7tnL2fj4RQYOJTYtaXUov1H1OQ8IJmPMA1D8uQ?= =?iso-8859-1?q?iR4BeFTyHaSQ/puS1CA9+c24Q2fWwpMT6Tr2qYS5BcGsQKoudykP5ppXZxuU?= =?iso-8859-1?q?P7vf0SNX/Zx4UnNqPB0fJL9CWhJk47QJ6Wqg2hfspsiuhLBGbKwOZmRsnMPG?= =?iso-8859-1?q?IkoFKxCEOnAUM7KOVcVQzwtdFQF56upLSWdije+kbounIiKnmmKrJgHofmku?= =?iso-8859-1?q?+eyh8T6p1jZeKZnu5RPjX9obaYaam4/lyhIc5Gwv/W1H7+dv9MfgT9pDKClt?= =?iso-8859-1?q?kUyF5B1QktzTrpS56rXJ1l8TpaEX2PSMSqtC2vN2UCGVe8JstewgW6D88tIK?= =?iso-8859-1?q?OIx+TLgUbWc5UpqDYFITA9IZwsVcOMYdh0CW+cOrswDD9bCJMHlLTGDoznIi?= =?iso-8859-1?q?QvQRQM7gEmu4lCQAULzYbLW+gYrOQ6E7iJoMgxGbrNXgD6hpTUPhDdztyc+z?= =?iso-8859-1?q?gpXKpZvjZpAWhWQKpbcN/azXgC8ij72OJV5N+gU4Et8VmlYcTIIo1wQGb8+0?= =?iso-8859-1?q?tCDz4bajF8o/47kw7aTXxOiJlKbY8PfNG24hNj1GjUUbYIDdEBrv1uHsQGYr?= =?iso-8859-1?q?EaOaQ/3+OSqMYveP7gmbXndxpspuEgRs59c/20Pe8zKQ+KSKa7VtN+exo2bo?= =?iso-8859-1?q?Qz08=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 5b03f6d4-da12-4bbe-5178-08d9c147d95c X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:38.2243 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GavLUNWdgE7VFLHAQ0X6gEJ3fSFx0h9iYWcq41QJ9mSoHboRubvIT2PvnSpaCBsa6PjhCGcDycvUTQEW14/0GQcfpmbjXM2YcZlxRoMioio= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0194 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E7F0C1A000B X-Stat-Signature: 1ne8xzbm6zy6ydooquctu8zc8sczizd6 Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.45 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639736859-739632 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: vma_mmu_pagesize() is only required for slices, otherwise there is a generic weak version doing the exact same thing. Move it to slice.c Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/mm/hugetlbpage.c | 11 ----------- arch/powerpc/mm/slice.c | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index ddead41e2194..0eec3b61bd13 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -565,17 +565,6 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, } #endif -unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) -{ - /* With radix we don't use slice, so derive it from vma*/ - if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) { - unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start); - - return 1UL << mmu_psize_to_shift(psize); - } - return vma_kernel_pagesize(vma); -} - bool __init arch_hugetlb_valid_size(unsigned long size) { int shift = __ffs(size); diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index f42711f865f3..8a3ac062b71e 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c @@ -759,4 +759,13 @@ int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, return !slice_check_range_fits(mm, maskp, addr, len); } + +unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) +{ + /* With radix we don't use slice, so derive it from vma*/ + if (radix_enabled()) + return vma_kernel_pagesize(vma); + + return 1UL << mmu_psize_to_shift(get_slice_psize(vma->vm_mm, vma->vm_start)); +} #endif From patchwork Fri Dec 17 10:27:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684213 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 2D8B5C433F5 for ; Fri, 17 Dec 2021 10:31:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47E806B007E; Fri, 17 Dec 2021 05:27:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 42E0C6B0080; Fri, 17 Dec 2021 05:27:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A8226B0081; Fri, 17 Dec 2021 05:27:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id 1E46A6B007E for ; Fri, 17 Dec 2021 05:27:57 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D9060181AC9CC for ; Fri, 17 Dec 2021 10:27:46 +0000 (UTC) X-FDA: 78926910132.16.F9DC1D5 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120088.outbound.protection.outlook.com [40.107.12.88]) by imf30.hostedemail.com (Postfix) with ESMTP id 2783F8001B for ; Fri, 17 Dec 2021 10:27:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0kHVsHQXrsQ9uiyJ4wJNxMAZCw65mJT9whsLBogGccdC5l6rTS+h8IPc+gHDjKLxJ9PRf2uXJONJXn6UYCTPa7CVg0uw8nredPjdI6O2g5pODY98XqSevkM+9vlS9Ixa67oxOjvueYtMOglVecmEzQGmpIIgLxONIX8LX1WtSHnp3TqGhilfT/xIo3t/FHyZVJsyNDyszPMGCbSYgWBM7wHXuxdGH18wWLPJQUIMVcOeihdH7O3/IiIUXDJyBE+cCLY+S+7OGz0L7GCgmw7YztH0p2zAEwJqXkqVvn395aUCLBlPkkWBy9rxHyWFW1urDEZfnwaL13wOO0tsG80Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Kal8uZy0vwBrMzZSbVRzSwNCiz8HNSzE2KXYS2+awQQ=; b=Ykj69sNVZx9hGohlsQj47S4LUP1+FnD8ESAuwkUy6dIdfU/t2U0CQz8E4uIzlXfawQfR577BbhAkwhUcGQShtuzEjQAzm+qdpwITtqxQdfgLILjIXZu10yRsL5z+PlVZNRayGTplAbYc5BsewQ6Y7FdRGnnS+54lx7aeguW3JUT0jLZRwquUW2sYmFjMOB28G/tCBndvb/9TGdJ0bA1CjwfeBcqisvn30Qs07GrbQ1XbO3ArLOF+rx5gSn4Uihmm6NTHlxGKgq2juDGo5YIo3nUNIdm+x7V/iLwxtZfSwxz6jfz1iabI5EWyaJT2YW71j9/YtSVZoCnQgpqGqkhBcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0146.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:43 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:43 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v6 07/14] powerpc/mm: Make slice specific to book3s/64 Thread-Topic: [PATCH v6 07/14] powerpc/mm: Make slice specific to book3s/64 Thread-Index: AQHX8zC688aLht4OC0+lqZbp9OnzKQ== Date: Fri, 17 Dec 2021 10:27:43 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 965c4765-15d8-4e25-37aa-08d9c147dc8c x-ms-traffictypediagnostic: MR2P264MB0146:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:178; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: znZTJlpSQ0Z/XFWA6+67i7nOpXRxp23ZtkfSvpW42tbA2ojDPjtvhYxPSDHrjK5i1Ji0csmqPugqsAkSbUJU8N93wZfovXqRBvzIYUfDFU/114xs+TtRB9s34ZCFL7rjrbEcPi44KEc82DV6yPZ1EYl8jZjRu43wDYF6BURHEucrGy3FQ7W2F50W4U2bgTqvua6a4p3TxPn8WbCw/feS1gOA3wcYWzv38iGqhMuUsSWOOr6lfA31Cb4IfWhHH80o0v1ZCfNvrrAO004KYt+lGi6752wtj6nmPAyYsgJ70NN9iwuGwe0NHh9L/mx4KCxOIgAAlJu9FhUG3PF+fRxaNbBpTno0vm4CHwgf+LBKiCfnaHEdxVuuF5R0hAJjAOZ63pZAu1sy2WpJUzxfnn+Wx2vHedUaI7ujMqZr3iSvH5SevTzq8F6fEGZtnx9Gr15QRVM225dC1P0WazMV6HlM+5mmGjP86eGRpNPu8Z64ijiO7d4amYblvNfQLJ/p4Nv7mTzhc1A1OMZYX4+tiDMp0mBQsILHIzSo9TsV5IriNjL0uLs01JYpEhYphMFAixdovAolEsJSkS1p7nnauZWIdyhAhSOvZ4IJcDaWRIeZSZdyUn8fiRng3qZiLLK/62/QYlLijGfzYTdN2p3IKDSYTpeSr+jnvdRij1zE4RSj8TeuPok2iEyadzAaKnlXdr140kT68j8v/BufRbVZuFAUqHJzHbnUjgQne7pA0wf+q1w= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(91956017)(71200400001)(86362001)(83380400001)(66476007)(66556008)(66446008)(2906002)(64756008)(38070700005)(7416002)(44832011)(6506007)(76116006)(4326008)(36756003)(26005)(2616005)(5660300002)(122000001)(8936002)(38100700002)(508600001)(6486002)(54906003)(110136005)(66946007)(8676002)(316002)(6512007)(32563001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?y6wikPlWJB4HEVM5rhK2Wiz?= =?iso-8859-1?q?73hymRJ4wCtzBFCDOUCyiLyFmbDZ0Wj3SxMLIFXkFrka73BFPbeL5j2o44SE?= =?iso-8859-1?q?znHfnfO3RQHMDGdERjIda4qrIUGsMrr9DcBRA6EIrJ4gS84ohQdaVoSYkJiK?= =?iso-8859-1?q?Gs2Zzdh7gMSyD+PdzfbqEKX8fZAGAdYR8pTUbxKUEc1FLy8zMuK9+N7GdkWK?= =?iso-8859-1?q?vNzekBuf7UU7rBIG3hhoGngXucqe834vbM3H4Glk6r3q7HDPpgGlHeCa4IVU?= =?iso-8859-1?q?NMTKFrm+zOIA0zWH9DRw0V+GQwp9FjHP6xypMCSmueA2v70iOrokybSvvFtI?= =?iso-8859-1?q?zpWhjmmCZM2X3wI+VkgbCKbciJJPEudtEcbFLqlsifRRS/d5yKCrki1JtcB4?= =?iso-8859-1?q?U8FL5WTMI6NcpxfMwXuWjA+y+5ifTW+v2zTK0w2YstrGnBxa2gUyRiEHQMRr?= =?iso-8859-1?q?ZHgWkYYFc0RJVBdW2sHthiCnUxbNOLaBXLDmqVm0hznuGahPuLfSCiytSH64?= =?iso-8859-1?q?6nvuCvqIG8HDK4O90XAohOV5hFi29hN1+sysJo+9iwREPjjzHOtN9eYo2Q0r?= =?iso-8859-1?q?iVWR+PpZuCwf1ceoQy35owrDlX0SHewga5gckuRIZuSY5KzNbeBggSbYJ4EB?= =?iso-8859-1?q?FbkrpGux/IlONwdTnK6e4BSgOJsJHzJWEFo7Ctelp6YPU49lfaaIhXXE+i73?= =?iso-8859-1?q?I0udcSS2xq0+9th98tnod7HSUa10KP1xuuPKzuemAqj2dCkjBe6Wv03O+EGP?= =?iso-8859-1?q?wBXUTJ7BHBR+7nZuaStBGLWcCKFpxDQ1pmHGPD/AZllvGJR/W6ApYKm+tqef?= =?iso-8859-1?q?AvoyeG0tFLxsVUVdeXvoZ/vLp3IYF5PBq5EBmGVBDpF5Np9EpXpzKqxNoNO4?= =?iso-8859-1?q?Wtwejr/dp12Sf6cVKrAMKyMr0DEiKEk/5dlsFIqW09hnSZtezVXpZxGnCdAm?= =?iso-8859-1?q?rKzyNe10PWPzlM7a+w+VAPrqK627VL1DpA2Ur7UQgtSFtGqnoRvEh4ojHKMW?= =?iso-8859-1?q?438Afh3Yr8sarD0GgrfD7VVfHRWwW1p+kBsgrNUDsqo5PVJhkaTHgmCaeMOZ?= =?iso-8859-1?q?qX/4darRyrQrOk5mZwFMGaeulZnbEUz/29iB8FG5T2z6E4kQ2OuCU/8PUIQ5?= =?iso-8859-1?q?BHfz3vUj+brJZeFn+21RTyPACM+4lZdzQ003m+Z9zfRURWE3VRhFU8sGTAiT?= =?iso-8859-1?q?VxryD3fs6dG9xC6y+8GpaSPR6oUeXdvOu7OtDYMDkK3j2fFRrVjIjpK8Y8Cg?= =?iso-8859-1?q?5c5f++EFDuFwK7yEOEAiX4v34RDVxHDLdxDzrLpXpwL+cBnC11+jt2g3PBHL?= =?iso-8859-1?q?IcS74/x2h33eI6CjXCMQchd0vOG72BHPGW1OVh7N8+pXk5xKVtdX9DSs5vv+?= =?iso-8859-1?q?fp5ScIGqAHAlp2vQWyIZRXkmCadZEsaDZllmk0psa2lZn2oOCraQ8ytCMvTR?= =?iso-8859-1?q?gRWLVEnuaK6UR8nPZPlEhFwIXsFuVfhGhz6jYjqo4Uwi96rylLFl48z8ufew?= =?iso-8859-1?q?qGM5ixS9Uw4cYmZ8QZuMii3gT9Lo8dgi7e/9ByXg/ZMlEHCIfVwan+CVKJ1U?= =?iso-8859-1?q?CuaSJrGXhfSx9bfXTDILKrm2YxcUfks2XaCkUkNSmcmOyPOoaRZP5posLzXm?= =?iso-8859-1?q?HOmlUOLoZOHyVd5iJn3ocO6dtUM0HnTw6zKluJbuvdCM+qlvQCB/ypLJBghf?= =?iso-8859-1?q?oT042TrRIdaipdzZMLUWWroTQ6JMDAx4x986nPH9eZp0pFQqM5lH/f4nLm+c?= =?iso-8859-1?q?iTok=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 965c4765-15d8-4e25-37aa-08d9c147dc8c X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:43.5870 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9Kz5mzuSmnrL+0M/ysaTDmDIuZptfwt4szyExX4q1fh7FlVQ6xDWrXcoqzrXpYXcbknaRShy1+6IAnz2XFh1uRfG2NaEwbQ5KnTBGROZZDc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0146 X-Rspamd-Queue-Id: 2783F8001B X-Stat-Signature: spagq7y9f579ujwzrk5jxubxekfrtndi Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf30.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.88 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam02 X-HE-Tag: 1639736865-47479 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: Since commit 555904d07eef ("powerpc/8xx: MM_SLICE is not needed anymore") only book3s/64 selects CONFIG_PPC_MM_SLICES. Move slice.c into mm/book3s64/ Move necessary stuff in asm/book3s/64/slice.h and remove asm/slice.h Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 + arch/powerpc/include/asm/book3s/64/slice.h | 18 ++++++++ arch/powerpc/include/asm/page.h | 1 - arch/powerpc/include/asm/slice.h | 46 ------------------- arch/powerpc/mm/Makefile | 1 - arch/powerpc/mm/book3s64/Makefile | 1 + arch/powerpc/mm/{ => book3s64}/slice.c | 2 - arch/powerpc/mm/nohash/mmu_context.c | 9 ---- arch/powerpc/mm/nohash/tlb.c | 4 -- 9 files changed, 20 insertions(+), 63 deletions(-) delete mode 100644 arch/powerpc/include/asm/slice.h rename arch/powerpc/mm/{ => book3s64}/slice.c (99%) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index 21f780942911..1c4eebbc69c9 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -18,6 +18,7 @@ * complete pgtable.h but only a portion of it. */ #include +#include #include #include diff --git a/arch/powerpc/include/asm/book3s/64/slice.h b/arch/powerpc/include/asm/book3s/64/slice.h index f0d3194ba41b..5b0f7105bc8b 100644 --- a/arch/powerpc/include/asm/book3s/64/slice.h +++ b/arch/powerpc/include/asm/book3s/64/slice.h @@ -2,6 +2,8 @@ #ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H #define _ASM_POWERPC_BOOK3S_64_SLICE_H +#ifndef __ASSEMBLY__ + #define SLICE_LOW_SHIFT 28 #define SLICE_LOW_TOP (0x100000000ul) #define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT) @@ -13,4 +15,20 @@ #define SLB_ADDR_LIMIT_DEFAULT DEFAULT_MAP_WINDOW_USER64 +struct mm_struct; + +unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, + unsigned long flags, unsigned int psize, + int topdown); + +unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr); + +void slice_set_range_psize(struct mm_struct *mm, unsigned long start, + unsigned long len, unsigned int psize); + +void slice_init_new_context_exec(struct mm_struct *mm); +void slice_setup_new_exec(void); + +#endif /* __ASSEMBLY__ */ + #endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */ diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 254687258f42..62e0c6f12869 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -329,6 +329,5 @@ static inline unsigned long kaslr_offset(void) #include #endif /* __ASSEMBLY__ */ -#include #endif /* _ASM_POWERPC_PAGE_H */ diff --git a/arch/powerpc/include/asm/slice.h b/arch/powerpc/include/asm/slice.h deleted file mode 100644 index 0bdd9c62eca0..000000000000 --- a/arch/powerpc/include/asm/slice.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_POWERPC_SLICE_H -#define _ASM_POWERPC_SLICE_H - -#ifdef CONFIG_PPC_BOOK3S_64 -#include -#endif - -#ifndef __ASSEMBLY__ - -struct mm_struct; - -#ifdef CONFIG_PPC_MM_SLICES - -#ifdef CONFIG_HUGETLB_PAGE -#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA -#endif -#define HAVE_ARCH_UNMAPPED_AREA -#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN - -unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, - unsigned long flags, unsigned int psize, - int topdown); - -unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr); - -void slice_set_range_psize(struct mm_struct *mm, unsigned long start, - unsigned long len, unsigned int psize); - -void slice_init_new_context_exec(struct mm_struct *mm); -void slice_setup_new_exec(void); - -#else /* CONFIG_PPC_MM_SLICES */ - -static inline void slice_init_new_context_exec(struct mm_struct *mm) {} - -static inline unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) -{ - return 0; -} - -#endif /* CONFIG_PPC_MM_SLICES */ - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_POWERPC_SLICE_H */ diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index df8172da2301..d4c20484dad9 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile @@ -14,7 +14,6 @@ obj-$(CONFIG_PPC_MMU_NOHASH) += nohash/ obj-$(CONFIG_PPC_BOOK3S_32) += book3s32/ obj-$(CONFIG_PPC_BOOK3S_64) += book3s64/ obj-$(CONFIG_NUMA) += numa.o -obj-$(CONFIG_PPC_MM_SLICES) += slice.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o obj-$(CONFIG_PPC_COPRO_BASE) += copro_fault.o diff --git a/arch/powerpc/mm/book3s64/Makefile b/arch/powerpc/mm/book3s64/Makefile index 2d50cac499c5..af2f3e75d458 100644 --- a/arch/powerpc/mm/book3s64/Makefile +++ b/arch/powerpc/mm/book3s64/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o endif obj-$(CONFIG_SPAPR_TCE_IOMMU) += iommu_api.o obj-$(CONFIG_PPC_PKEY) += pkeys.o +obj-$(CONFIG_PPC_MM_SLICES) += slice.o # Instrumenting the SLB fault path can lead to duplicate SLB entries KCOV_INSTRUMENT_slb.o := n diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/book3s64/slice.c similarity index 99% rename from arch/powerpc/mm/slice.c rename to arch/powerpc/mm/book3s64/slice.c index 8a3ac062b71e..e4382713746d 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/book3s64/slice.c @@ -692,7 +692,6 @@ void slice_init_new_context_exec(struct mm_struct *mm) bitmap_fill(mask->high_slices, SLICE_NUM_HIGH); } -#ifdef CONFIG_PPC_BOOK3S_64 void slice_setup_new_exec(void) { struct mm_struct *mm = current->mm; @@ -704,7 +703,6 @@ void slice_setup_new_exec(void) mm_ctx_set_slb_addr_limit(&mm->context, DEFAULT_MAP_WINDOW); } -#endif void slice_set_range_psize(struct mm_struct *mm, unsigned long start, unsigned long len, unsigned int psize) diff --git a/arch/powerpc/mm/nohash/mmu_context.c b/arch/powerpc/mm/nohash/mmu_context.c index 85b048f04c56..ccd5819b1bd9 100644 --- a/arch/powerpc/mm/nohash/mmu_context.c +++ b/arch/powerpc/mm/nohash/mmu_context.c @@ -317,15 +317,6 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, */ int init_new_context(struct task_struct *t, struct mm_struct *mm) { - /* - * We have MMU_NO_CONTEXT set to be ~0. Hence check - * explicitly against context.id == 0. This ensures that we properly - * initialize context slice details for newly allocated mm's (which will - * have id == 0) and don't alter context slice inherited via fork (which - * will have id != 0). - */ - if (mm->context.id == 0) - slice_init_new_context_exec(mm); mm->context.id = MMU_NO_CONTEXT; mm->context.active = 0; pte_frag_set(&mm->context, NULL); diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c index 311281063d48..3359cf7c2a61 100644 --- a/arch/powerpc/mm/nohash/tlb.c +++ b/arch/powerpc/mm/nohash/tlb.c @@ -773,9 +773,5 @@ void __init early_init_mmu(void) #ifdef CONFIG_PPC_47x early_init_mmu_47x(); #endif - -#ifdef CONFIG_PPC_MM_SLICES - mm_ctx_set_slb_addr_limit(&init_mm.context, SLB_ADDR_LIMIT_DEFAULT); -#endif } #endif /* CONFIG_PPC64 */ From patchwork Fri Dec 17 10:27:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684215 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 E4978C433F5 for ; Fri, 17 Dec 2021 10:31:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47F0D6B0080; Fri, 17 Dec 2021 05:28:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 42E6B6B0081; Fri, 17 Dec 2021 05:28:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A8176B0082; Fri, 17 Dec 2021 05:28:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1E33C6B0080 for ; Fri, 17 Dec 2021 05:28:01 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D8FC18249980 for ; Fri, 17 Dec 2021 10:27:50 +0000 (UTC) X-FDA: 78926910300.28.1FDF4B6 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120059.outbound.protection.outlook.com [40.107.12.59]) by imf23.hostedemail.com (Postfix) with ESMTP id 85910140011 for ; Fri, 17 Dec 2021 10:27:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RoQLj1n4uD23yVRU+k1i8EukaH8lLs/0WoviHhciKPD5Se65i7VZ4zEqT4ye+8Rn4teKdlIml6a7HOyIbB7+Iwq6H9DFF33zueHn4WE7X5P+3fpHNKsv8PQDXxVOJ6ETKt3Z9u/E9bTiYRM9I/9DeM/CD2lG3TqHGdz/8gU3u0nS34kEaXklvKJZpLNjiTWD+Ei37XdbWB6tgN3YlMLofIrAelFYiMbkSinooL0CCUErOWcf/YiUpOOyljwj0jfxgvtxlGXT4ZQ+zfxocu3sMQYS/2TqxTO71tqVoDepEA7IRzH4PlJ4ub1GgeW3ECEKK0ErC2J4DWHgGnMoblFgRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=39FFmOvJEbICLmGjehFIN4rt9ehZmkF/y1NsezPHRsA=; b=fAg+OcXmW5ujhdm2sUdJkI+qKsPxgT0PKwSzH1xdwQi+ndcKyt+6gkuET680UUN8p6abfUMCTFXJLWEeKcJ+UOwHXxQLvLaLJN/aTCzisVjqtcyMdB48T8YHr7sXQ7xaBzPY6z3QPaJVXk/DAcpOmNJTh9ukNrdoIJGTWv2r2S9qA7aD8QwJ5PJs4vdAjC14ruS5G8vgqAUkJEn41ybz2D90jHx8RQAU0yGKQDLHL+FC81Ey3DYcNne0nUd4N8PZpuODTfIxFD5AcIbgQCA//WC9yCQ3gKPLBjSdWcmMXVion9JUrpGED64dWDfgdoakdz/9P7cXFUmJHccTIEg2wQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0146.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:48 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:48 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Nicholas Piggin Subject: [PATCH v6 08/14] powerpc/mm: Remove CONFIG_PPC_MM_SLICES Thread-Topic: [PATCH v6 08/14] powerpc/mm: Remove CONFIG_PPC_MM_SLICES Thread-Index: AQHX8zC9azDg+V7pj0qHryg9Tl75pw== Date: Fri, 17 Dec 2021 10:27:48 +0000 Message-ID: <5628af991a438cf96d06df5f40bb945742928b95.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 63bf9857-ef8c-4c1f-a4d0-08d9c147df89 x-ms-traffictypediagnostic: MR2P264MB0146:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: w24+gJ3vBvDiLYPnbQ+YhVW4SPltr7LGzVw378mBhH6XZmngzKddZpbiy9Sb4aYdq1tqDwxQNTbKmQuH2n0XAbXo/yOPvSwiNsnt4aEfLdqbviNNnQkq4uc91NomOAoCC1n/wg58PNrPIqHgMmDX//oOWQ4/axKhuKxgCikYmSa9t4iEA0zvXGHOm4SWeix8S+AVQhyZxg+KvWFzdHAEJHy/YolbsDBUyH/Do9TCMosyCyEYYdiElv3pNMmH8GgLf7r1s8fkNcoBwVvBoACvsn/GyECqV5jo8ZsigJT31qMfxEUsQAC2cRIwZaPsFUCA3fX371KsAoKXy1AF0H9J+J7tt34tHC+FMtOOgzufRcp1Hw1wC823uIGsbf7kWtILb4+QqvcLPdjGJuhh5u4p6fBusg+gkuOzaBOQRso8O8t7Sc5Upm/Qk5qjuVLmHwIS2CvBAXDMjPhliHeOlJaMTV+weCsvn3mNyQPtVqhAdcY1GsPoHJfLV2JEKTRZdgMxx/LrlI0EFXPw/svksIM09GTuyuyWGq4CynhVzGI/3RuacJgWZe4aAyYRu3siNKtn47D94mVxLtIYADdxlbdg2cBkMOvsjeyE1wIArsgaS9Y4dcyM5zvZibXyJOkiFKrEM6UJgr1AFv9Ve6ngDbFIT13MxRwUQo+LtrlntUTjzhP5RfESEOSl9yx3wkfFxaP8c2Ej5ECA+esX+1fDNPqd5g== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(91956017)(71200400001)(86362001)(83380400001)(66476007)(66556008)(66446008)(2906002)(64756008)(38070700005)(7416002)(44832011)(6506007)(76116006)(4326008)(36756003)(26005)(2616005)(5660300002)(122000001)(8936002)(38100700002)(508600001)(6486002)(54906003)(110136005)(66946007)(8676002)(316002)(6512007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?GCMrwfus0uM3b0MtByzAtsy?= =?iso-8859-1?q?o0yqux+jKQvHtqLQznQoBQMyCrMd9ZID7rPjJHEsZlxn8lz6JOmfR5h4liJ1?= =?iso-8859-1?q?Ei8i20WNz4hzJ0Qa688ClnlTNeADgCuFz7XywPlrlwTrVBzBTsx+rSAPoMiN?= =?iso-8859-1?q?u72IEndpiU368wgpUmMJ1BRto1hMfj+9eBs9rAfgYTNYXVQUCBWF59DlE0Iy?= =?iso-8859-1?q?UnOujJBrPPfh2nUFvttUGfsjAI+wTjTstSURakX8Ig+yvgMXQtHkpnpYMqJE?= =?iso-8859-1?q?zf+P3Qupn1w/3OfCbAu60QmVNBkvjbyUwU3NT5IPnUBsPTSqCO8X4lBcrsw1?= =?iso-8859-1?q?UMeHCyhSGc9xE4nEZivJsydQZo3j4Qym8Zqo568wJ610SU2FK15xei33kJYw?= =?iso-8859-1?q?dMlUGLJwHf6HdnggK6W9X4N7Xu+ZSYyRZrrjr/HGT0eV7hGu1OjC/eipCI99?= =?iso-8859-1?q?qiqJh45Qj7Io6yfokfingsvxnbuw4FULPWiOgnBunkfasFvM739lBH75mC2K?= =?iso-8859-1?q?OTyObiqtCBfhOYYIVA8l4nUrKh5ziCz897H6J39QXs2h+OpuXAgXm6SU8YaF?= =?iso-8859-1?q?2qOHyosOHvY9h7LQ/rqLTb5YRjSdC2IG8G6lsjy30MN+tWdTwION8Aw7UqqY?= =?iso-8859-1?q?B6Tqev/e+7V6CyyO7iSExBopzVNt0wJNjP+Vjc39mFL9cY21kj0feVuVsC6d?= =?iso-8859-1?q?K1oJp72yu1ZvUibqJPpFpf7XgE8W13q3VUb5FngoK2EPCzPfc/EC4iMtX53N?= =?iso-8859-1?q?lLx/eQAQu+0J+63m4IQd6PJdla9ffb5Qa4sOsfH9BoUMYTlIja2H2VjwwouG?= =?iso-8859-1?q?EaUhg1vWixecLiqjhPuFZTjlBVDjrLvH5YGjnu2eWa6Rd/p7YfwnHZxYHzel?= =?iso-8859-1?q?qiotvyNvXVKsoMcU58Ek09VAdWX93119EYwmnu3wWyQjUyKmKsap+ZultVce?= =?iso-8859-1?q?DauH+uJLW7E0iXQlz/MxO7k/1wOXq0Az+dQ4/k8lfnRyBiLzTcAnDXJcih2F?= =?iso-8859-1?q?D+IV2ISZL8aqCmptfjANqkQmvUV/KUzoBfOKdVUSOtvstgdlz6rrSEOQggjl?= =?iso-8859-1?q?I6Xvn2Vi16Wu+YsV4luWGzs8g3iSQu5C3aRU8D863rif1/H6bpWffDi1KrZ9?= =?iso-8859-1?q?BwbgHIdyB7mlOxAGP6rnDgnoBgwrKS6pD1qjueeVHhoFj71bQE17xbK2CBOT?= =?iso-8859-1?q?H/X7fIj3EQmxLoBELkTVb9DdRy4g70WzU5fVvR+wcWSw3bes7HJEA9UP8MV/?= =?iso-8859-1?q?wbXDKndoK56fTB+UriZriH+xBRp5OQYVtEbpZUXk0cYra/9/MBcC42kKxJ3E?= =?iso-8859-1?q?MuUDUClMI8e40CBS0fTdd46GU9fH9Z2ANPcpFbyWtHIr2WIZi4Km+82B2bWD?= =?iso-8859-1?q?R9IMwPoDpl4xmNUMfALRXzZI4MTS5M6xVEYtYRmqia9sXmD8i/EpZhlTt8W4?= =?iso-8859-1?q?N4ePnAa8MKQodrOLo8xT2No5tkvHTXEGacV63Z2aWAnDnF/Ly7VYuR2tHRs1?= =?iso-8859-1?q?eE/IolAO1wwpwO4y/OmfeLZ6HjViNxOvJdPuLGo0gjNTeZQvZgUKXKxhBT9t?= =?iso-8859-1?q?S0kDysTl8LDpG0SUkNAzjlpP8Aua6APBSjZ2Z70ZUl2gjmG89+eHBPyg01mz?= =?iso-8859-1?q?aciOaz2qLO+H1BFB8I5g1rdi9bBXcdD0HlxxdNdg5OU3HZ7q2Ys15p1Jwh0o?= =?iso-8859-1?q?DqjqZtjJUlLAd6UXmqz7NfR0AFCuElDUCrjAKZJ1yE9SZFrjrvWgw39cgsKD?= =?iso-8859-1?q?wTK8=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 63bf9857-ef8c-4c1f-a4d0-08d9c147df89 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:48.6346 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: j5CO/SMK7sTLP/QelzLr2ae8Ca0DLwEwSTFwJ6Oh9YFx/8rBX8rk76WGVUqT+Rl6Q5rwt3y4GhaChdh7zZNQWyioJuBMjelAfdRLwDTvzmw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0146 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 85910140011 X-Stat-Signature: 5rfoa7io3hafx16tyhfn9xim14u3dkg9 Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.59 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639736865-854062 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: CONFIG_PPC_MM_SLICES is always selected by hash book3s/64. CONFIG_PPC_MM_SLICES is never selected by other platforms. Remove it. Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/include/asm/hugetlb.h | 2 +- arch/powerpc/include/asm/paca.h | 7 ------- arch/powerpc/kernel/paca.c | 5 ----- arch/powerpc/mm/book3s64/Makefile | 3 +-- arch/powerpc/mm/book3s64/hash_utils.c | 14 -------------- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/mmap.c | 4 ++-- arch/powerpc/platforms/Kconfig.cputype | 4 ---- 8 files changed, 5 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index f18c543bc01d..86a60ba6bd2a 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -24,7 +24,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, unsigned long len) { - if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) + if (IS_ENABLED(CONFIG_PPC_64S_HASH_MMU) && !radix_enabled()) return slice_is_hugepage_only_range(mm, addr, len); return 0; } diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 295573a82c66..bd4dd02e61c8 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -152,16 +152,9 @@ struct paca_struct { struct tlb_core_data tcd; #endif /* CONFIG_PPC_BOOK3E */ -#ifdef CONFIG_PPC_BOOK3S #ifdef CONFIG_PPC_64S_HASH_MMU -#ifdef CONFIG_PPC_MM_SLICES unsigned char mm_ctx_low_slices_psize[BITS_PER_LONG / BITS_PER_BYTE]; unsigned char mm_ctx_high_slices_psize[SLICE_ARRAY_SIZE]; -#else - u16 mm_ctx_user_psize; - u16 mm_ctx_sllp; -#endif -#endif #endif /* diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index 39da688a9455..ba593fd60124 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c @@ -344,15 +344,10 @@ void copy_mm_to_paca(struct mm_struct *mm) { mm_context_t *context = &mm->context; -#ifdef CONFIG_PPC_MM_SLICES VM_BUG_ON(!mm_ctx_slb_addr_limit(context)); memcpy(&get_paca()->mm_ctx_low_slices_psize, mm_ctx_low_slices(context), LOW_SLICE_ARRAY_SZ); memcpy(&get_paca()->mm_ctx_high_slices_psize, mm_ctx_high_slices(context), TASK_SLICE_ARRAY_SZ(context)); -#else /* CONFIG_PPC_MM_SLICES */ - get_paca()->mm_ctx_user_psize = context->user_psize; - get_paca()->mm_ctx_sllp = context->sllp; -#endif } #endif /* CONFIG_PPC_64S_HASH_MMU */ diff --git a/arch/powerpc/mm/book3s64/Makefile b/arch/powerpc/mm/book3s64/Makefile index af2f3e75d458..d527dc8e30a8 100644 --- a/arch/powerpc/mm/book3s64/Makefile +++ b/arch/powerpc/mm/book3s64/Makefile @@ -5,7 +5,7 @@ ccflags-y := $(NO_MINIMAL_TOC) obj-y += mmu_context.o pgtable.o trace.o ifdef CONFIG_PPC_64S_HASH_MMU CFLAGS_REMOVE_slb.o = $(CC_FLAGS_FTRACE) -obj-y += hash_pgtable.o hash_utils.o hash_tlb.o slb.o +obj-y += hash_pgtable.o hash_utils.o hash_tlb.o slb.o slice.o obj-$(CONFIG_PPC_HASH_MMU_NATIVE) += hash_native.o obj-$(CONFIG_PPC_4K_PAGES) += hash_4k.o obj-$(CONFIG_PPC_64K_PAGES) += hash_64k.o @@ -21,7 +21,6 @@ obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o endif obj-$(CONFIG_SPAPR_TCE_IOMMU) += iommu_api.o obj-$(CONFIG_PPC_PKEY) += pkeys.o -obj-$(CONFIG_PPC_MM_SLICES) += slice.o # Instrumenting the SLB fault path can lead to duplicate SLB entries KCOV_INSTRUMENT_slb.o := n diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c index eced266dc5e9..7ecadf5e6bf9 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -1264,7 +1264,6 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap) return pp; } -#ifdef CONFIG_PPC_MM_SLICES static unsigned int get_paca_psize(unsigned long addr) { unsigned char *psizes; @@ -1281,12 +1280,6 @@ static unsigned int get_paca_psize(unsigned long addr) return (psizes[index >> 1] >> (mask_index * 4)) & 0xF; } -#else -unsigned int get_paca_psize(unsigned long addr) -{ - return get_paca()->mm_ctx_user_psize; -} -#endif /* * Demote a segment to using 4k pages. @@ -1710,7 +1703,6 @@ DEFINE_INTERRUPT_HANDLER_RAW(do_hash_fault) return 0; } -#ifdef CONFIG_PPC_MM_SLICES static bool should_hash_preload(struct mm_struct *mm, unsigned long ea) { int psize = get_slice_psize(mm, ea); @@ -1727,12 +1719,6 @@ static bool should_hash_preload(struct mm_struct *mm, unsigned long ea) return true; } -#else -static bool should_hash_preload(struct mm_struct *mm, unsigned long ea) -{ - return true; -} -#endif static void hash_preload(struct mm_struct *mm, pte_t *ptep, unsigned long ea, bool is_exec, unsigned long trap) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 0eec3b61bd13..f18b3a1d18f0 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -558,7 +558,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, return radix__hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); #endif -#ifdef CONFIG_PPC_MM_SLICES +#ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); #endif BUG(); diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index c475cf810aa8..9b0d6e395bc0 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -190,7 +190,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long pgoff, unsigned long flags) { -#ifdef CONFIG_PPC_MM_SLICES +#ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, mm_ctx_user_psize(¤t->mm->context), 0); #else @@ -204,7 +204,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, const unsigned long pgoff, const unsigned long flags) { -#ifdef CONFIG_PPC_MM_SLICES +#ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr0, len, flags, mm_ctx_user_psize(¤t->mm->context), 1); #else diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 87bc1929ee5a..c775b566e7b4 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -376,7 +376,6 @@ config SPE config PPC_64S_HASH_MMU bool "Hash MMU Support" depends on PPC_BOOK3S_64 - select PPC_MM_SLICES default y help Enable support for the Power ISA Hash style MMU. This is implemented @@ -450,9 +449,6 @@ config PPC_BOOK3E_MMU def_bool y depends on FSL_BOOKE || PPC_BOOK3E -config PPC_MM_SLICES - bool - config PPC_HAVE_PMU_SUPPORT bool From patchwork Fri Dec 17 10:27:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684217 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 6CE4AC433F5 for ; Fri, 17 Dec 2021 10:32:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA5C46B0081; Fri, 17 Dec 2021 05:28:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7C056B0082; Fri, 17 Dec 2021 05:28:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1DE76B0083; Fri, 17 Dec 2021 05:28:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by kanga.kvack.org (Postfix) with ESMTP id B45526B0081 for ; Fri, 17 Dec 2021 05:28:07 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 759ED89078 for ; Fri, 17 Dec 2021 10:27:57 +0000 (UTC) X-FDA: 78926910594.06.9437A84 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90054.outbound.protection.outlook.com [40.107.9.54]) by imf11.hostedemail.com (Postfix) with ESMTP id DF12340017 for ; Fri, 17 Dec 2021 10:27:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XvJ0eHgsX3LejI2BRmnYXYO3+496znch4BFMYqqKCf+RGGxUfh0UT0XBaKwUTPGIz1/HisoEdZ15bF7IbjnWCceqhwzpmgVeDS05GruQaCwnhhkTlFvvwo07Ch7IQpTLkxuCi36ekUrGd46ttKhP2Ub3gDNTklLcKLyu/deKlQoQUbHxVXpt1j6CYYObHQPXebVQd8LuK1BKEIo8sRxGKkTqTDGrPPRlxxXyD7VHFtaIoNp1aigZuolui2mJwhtHnaptr2glbdykbRa46/w8VHytKOb2Ywi3nDsUJaqN785+iPPu2zA6VHdei1z2XL1evLjFnvG4UE1UjYE7rJDd+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1/H5LlacuEM5f+URl9CL6CXXwKhBdc5iypoM/HPJGE8=; b=PY2XRcP2KwdniQDEpz56RQ52VEJzwBBe8enfKj3R9y9dGw5hVrbfI1+HNKNCndJIInYe71KznHQpX35qR6HdHO/OQX6jpioKQCuA0qbJycWe1OaE8opQqB/8eXpqIgSdqI/5xM5viCYVkXCwdwF9mJqmNuHr3xf7HphWeKRr4K9B1QVC3UuBEbg4szjDuNyEnsri1mOk9Xc06j2VtIxiI9LA0dXU4NoUzDOWrlA0036p1GMSNpRDkS4uL76xNVCxWPjeJfpzO4pjIvlqBO2aPD8n6rpjaoQcCEG3vS4a68LOYdEtColsI8Rb8pfoeoN8kaMGL5sMca/x4vyM5NuStg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0194.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:27:55 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:27:55 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 09/14] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() Thread-Topic: [PATCH v6 09/14] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area() Thread-Index: AQHX8zDA7wQ3g07WgkWIeuZ4wqz97A== Date: Fri, 17 Dec 2021 10:27:55 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cca97c2f-3997-4bad-4b71-08d9c147e365 x-ms-traffictypediagnostic: MR2P264MB0194:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NeCtnT0CGOj3qAuqQHSmbiKSzOpq/jT+H/dPbc9W9UYTbSMc4u1WL949WfcXR87I9crDwNSuiSe1wQLxEKzZ6zPVg3Wl6SUA7zQ0dtRtI0F/Ac01LdLZP84w+bkPGmn4sDylB3IUn49OHuveZDV8yLIx8ljOc3U64e4BnOxmGIAZ090u8q7wZH+d2wP/NHE7ptcA9lqwttnfEAYpshxcxzGcruYMmNC9bCVVF5+2DWnETdbFKmx6eBiNSiJYxVLJH6OTRj+syrnSwbybKG4rbFqlLWYOszKA3ga3rwSd4H2jSMcTyypHiAByoZiQCCOwyVE3R/1rHGTdZZVyMg0HNGc7ImfTFq3F8mRZPRusHvYFBX0t1aVsRcl3Wam5WB6JeYSRzOUNrfDmyh7yRuKiG/Dwz8NOaj+ThUZ0hVv3ShAKIaf12PoPyMSu1VvCKGpulz2dytvILDWSYFYHcfPmzWme+hpP92jfnTTwPShi4l3xOFcS7rrrQCR0cK4B5XjTvjmhfX4cRzPnAlXNWPCLKH+Ny2OseCcgXfx89stpDEjv/nzF2G9DbCZzjj9cG0Pi7AA4wMD1ogmoKvEVP69WuGPVnBwSbu98d1/97n1mOdOrN/+onKQaFIDceRMibctmAvIyX4yYR09JXedBdVuInwsuz1NHDaMCvhEEKLNnYWIl4RWuZ0zxyGyXSirUCGKbiZyRnw87vB93IUizSPUM8Rjy4aJvIuMvEWZ1KuYQcwA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(122000001)(2906002)(66476007)(66556008)(7416002)(36756003)(316002)(38100700002)(186003)(44832011)(6506007)(66946007)(91956017)(6486002)(26005)(508600001)(4326008)(76116006)(2616005)(8676002)(8936002)(66446008)(71200400001)(83380400001)(110136005)(64756008)(38070700005)(6512007)(54906003)(5660300002)(86362001)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?vE/VB+s/cuHaVigQjZGUIjB?= =?iso-8859-1?q?LRSC4GK9p54HVKHaVv09PK8XIHzzH6JJVGaWevFFdt4ln5rQlTU8+IuijXKl?= =?iso-8859-1?q?GqUQ9JNrzP7TxQr7M3g5KASSgr9syklfopoaFKbLn2MZESlB0yXi8bOJmd7k?= =?iso-8859-1?q?hKEENHUjfmdy3RxDysk3l3UDRnK7DhCfptzoO+aSHTn8kIeqoGnNfdacxKGR?= =?iso-8859-1?q?19IKgJpXcHPjH0/u6Mb1v/pDbtTBHHtvthv7PN2RtbQMEB3e23eFGAqEgJCa?= =?iso-8859-1?q?mAbJH9a1b2Qia977uSSjh44c8OBVosujEnbuhfF6ot3xrJwmciZpr2f7mETP?= =?iso-8859-1?q?m+GslT4Byaq334pVo6qYolldX8Z7MCMfwlO6RQWk/xutsHiI29iLZr5Nu3ng?= =?iso-8859-1?q?DT9awR1PN9S/dyS668tjoSPKJD2ERI8t15R88oyPlsi8JxQT+QWMl3pwLUoX?= =?iso-8859-1?q?oBUIm9Bau0NsgpQecWWid9auUj+SJjqkW1La2LUX7aROkmcnDHWVNwq6RkhX?= =?iso-8859-1?q?XdjH/g92sZgT3Yc2VvExABIctioOzqL+lg0U8and1pULn7cgPtoO9yxX3QBQ?= =?iso-8859-1?q?SVQndfejU8p7NB+g95xkgEQnPw0ya0Caiau2N66Ce0qLe5qCAMwxE8IaWbrt?= =?iso-8859-1?q?Zfl8gqi0ttlfgu5VLLvYucEjujxr+WZSZ/+BCp1dSqcFtv5wsafji86fsX82?= =?iso-8859-1?q?AvGURxPn/0BxSvJVcEO0zjpqk9jvFILIEslT5MwW+ykLjA77TCeAv0ChjllK?= =?iso-8859-1?q?UzYjYjio7nCG7FgqX7T5undAiScS0tOCVvC/h9yy9a5RXPtjjhp5r+KYgbn5?= =?iso-8859-1?q?nRsb8NCqBx4fbjqOkDTgKwnKekR84QzeOxVrDr1VH3LHll2bxGapE+3R7+WD?= =?iso-8859-1?q?Z0QRpRRCC1EurzP7tBS0ud5WcRjF7rd9uh+0c+cL/18NwlxGlsNlN5qyms3m?= =?iso-8859-1?q?Hf/zC59q/baLpfztrnfdpUL4bxxpfQj4mIMhF6Ap0b/Nh2KdIeax9o7b7Yrd?= =?iso-8859-1?q?1sS+qGM19ks0Nnffoj22mlvw/OSUyj4GjcLNt6LoRfQxdsRuytUm2AfWmYU4?= =?iso-8859-1?q?xjb1NQPKhMiyGB97sZglukd7DR60zy0wBj4fZZvLK+I13cZ7pCmwKSygdEKt?= =?iso-8859-1?q?0vTKmQxxLbc33x2LCHWvSVdf2GvlkPjRUFu8m2rgkzVq4JgO4ozOhRIfg3m8?= =?iso-8859-1?q?1RiFB9f3XqYZMZXQzmytF7H2AH1ZwnyBBF6mgfA6uzWrCsKeg347D9YpGD6Z?= =?iso-8859-1?q?METlMlgbEQ42D8AphOKQXC7ellMXKqTe2m3BDmX23O19SIL0CTqq3U/xNUA4?= =?iso-8859-1?q?45YrQMDpn3oIfMKDWXlzHnY7nUrrURT2/Z7JPA1qEIFrpLBoSadGG5U8VAJv?= =?iso-8859-1?q?FHH18vdewpAOZAaQvlkyLTVFzjHE7XBh66OWKJe3VzeOrF9HOTSjPyJQWm0g?= =?iso-8859-1?q?9h8SiyFOrgHIkXzfGbpNpaStGe1eJVEL4mAndnRKjFP5Le5OaxNDauu7+Z3s?= =?iso-8859-1?q?qMPLSxcWekHedHd1qbox4Qx+d3thx//1sG2gT5Hlo+bCnYwBpO167Bi0TUEq?= =?iso-8859-1?q?emfL/DdMtob3wNgY5FkXYzcxvZ1fymlCwEZj6uskUHgMZGxqzD9ESOwfCtVR?= =?iso-8859-1?q?q8clFK036Hke3H4w7B14EKD40wxoopeRXGS/b3CSXqKHgVU9l1ozxrU2b/py?= =?iso-8859-1?q?AIDFh2wY7qsWsvQiJMF30YfYKP8T0n3gh+MoLsGBz7NFCNSIntLbty4H7jVg?= =?iso-8859-1?q?U270=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: cca97c2f-3997-4bad-4b71-08d9c147e365 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:27:55.0447 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5jyt6VKyqtPWpXc0+9osnGMJ5XoxIQmCDMvFrPaCVDfHd0bZcVEXQ25FU4TogD9qRVYOPaj0RTeKTXK5r5MQfYGp913xEHMWShENuL3hOyk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0194 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DF12340017 X-Stat-Signature: bjuo1qxgbjk1teem6fggdb4h3qfqhtcw Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.54 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639736874-50081 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: Use the generic version of arch_get_unmapped_area() which is now available at all time instead of its copy radix__arch_get_unmapped_area() To allow that for PPC64, add arch_get_mmap_base() and arch_get_mmap_end() macros. Instead of setting mm->get_unmapped_area() to either arch_get_unmapped_area() or generic_get_unmapped_area(), always set it to arch_get_unmapped_area() and call generic_get_unmapped_area() from there when radix is enabled. Do the same with radix__arch_get_unmapped_area_topdown() Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/task_size_64.h | 8 ++ arch/powerpc/mm/mmap.c | 127 ++---------------------- 2 files changed, 14 insertions(+), 121 deletions(-) diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h index c993482237ed..0544764b32c3 100644 --- a/arch/powerpc/include/asm/task_size_64.h +++ b/arch/powerpc/include/asm/task_size_64.h @@ -76,4 +76,12 @@ #define STACK_TOP_MAX TASK_SIZE_USER64 #define STACK_TOP (is_32bit_task() ? STACK_TOP_USER32 : STACK_TOP_USER64) +#define arch_get_mmap_base(addr, base) \ + (((addr) > DEFAULT_MAP_WINDOW) ? (base) + TASK_SIZE - DEFAULT_MAP_WINDOW : (base)) + +#define arch_get_mmap_end(addr, len, flags) \ + (((addr) > DEFAULT_MAP_WINDOW) || \ + (((flags) & MAP_FIXED) && ((addr) + (len) > DEFAULT_MAP_WINDOW)) ? TASK_SIZE : \ + DEFAULT_MAP_WINDOW) + #endif /* _ASM_POWERPC_TASK_SIZE_64_H */ diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 9b0d6e395bc0..46781d0103d1 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -81,115 +81,15 @@ static inline unsigned long mmap_base(unsigned long rnd, } #ifdef HAVE_ARCH_UNMAPPED_AREA -#ifdef CONFIG_PPC_RADIX_MMU -/* - * Same function as generic code used only for radix, because we don't need to overload - * the generic one. But we will have to duplicate, because hash select - * HAVE_ARCH_UNMAPPED_AREA - */ -static unsigned long -radix__arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - int fixed = (flags & MAP_FIXED); - unsigned long high_limit; - struct vm_unmapped_area_info info; - - high_limit = DEFAULT_MAP_WINDOW; - if (addr >= high_limit || (fixed && (addr + len > high_limit))) - high_limit = TASK_SIZE; - - if (len > high_limit) - return -ENOMEM; - - if (fixed) { - if (addr > high_limit - len) - return -ENOMEM; - return addr; - } - - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (high_limit - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - - info.flags = 0; - info.length = len; - info.low_limit = mm->mmap_base; - info.high_limit = high_limit; - info.align_mask = 0; - - return vm_unmapped_area(&info); -} - -static unsigned long -radix__arch_get_unmapped_area_topdown(struct file *filp, - const unsigned long addr0, - const unsigned long len, - const unsigned long pgoff, - const unsigned long flags) -{ - struct vm_area_struct *vma; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - int fixed = (flags & MAP_FIXED); - unsigned long high_limit; - struct vm_unmapped_area_info info; - - high_limit = DEFAULT_MAP_WINDOW; - if (addr >= high_limit || (fixed && (addr + len > high_limit))) - high_limit = TASK_SIZE; - - if (len > high_limit) - return -ENOMEM; - - if (fixed) { - if (addr > high_limit - len) - return -ENOMEM; - return addr; - } - - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (high_limit - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - - info.flags = VM_UNMAPPED_AREA_TOPDOWN; - info.length = len; - info.low_limit = max(PAGE_SIZE, mmap_min_addr); - info.high_limit = mm->mmap_base + (high_limit - DEFAULT_MAP_WINDOW); - info.align_mask = 0; - - addr = vm_unmapped_area(&info); - if (!(addr & ~PAGE_MASK)) - return addr; - VM_BUG_ON(addr != -ENOMEM); - - /* - * A failed mmap() very likely causes application failure, - * so fall back to the bottom-up function here. This scenario - * can happen with large stack limits and large mmap() - * allocations. - */ - return radix__arch_get_unmapped_area(filp, addr0, len, pgoff, flags); -} -#endif - unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { + if (radix_enabled()) + return generic_get_unmapped_area(filp, addr, len, pgoff, flags); + #ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, mm_ctx_user_psize(¤t->mm->context), 0); @@ -204,6 +104,9 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, const unsigned long pgoff, const unsigned long flags) { + if (radix_enabled()) + return generic_get_unmapped_area_topdown(filp, addr0, len, pgoff, flags); + #ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr0, len, flags, mm_ctx_user_psize(¤t->mm->context), 1); @@ -213,21 +116,6 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, } #endif /* HAVE_ARCH_UNMAPPED_AREA */ -static void radix__arch_pick_mmap_layout(struct mm_struct *mm, - unsigned long random_factor, - struct rlimit *rlim_stack) -{ -#ifdef CONFIG_PPC_RADIX_MMU - if (mmap_is_legacy(rlim_stack)) { - mm->mmap_base = TASK_UNMAPPED_BASE; - mm->get_unmapped_area = radix__arch_get_unmapped_area; - } else { - mm->mmap_base = mmap_base(random_factor, rlim_stack); - mm->get_unmapped_area = radix__arch_get_unmapped_area_topdown; - } -#endif -} - /* * This function, called very early during the creation of a new * process VM image, sets up which VM layout function to use: @@ -239,9 +127,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) if (current->flags & PF_RANDOMIZE) random_factor = arch_mmap_rnd(); - if (radix_enabled()) - return radix__arch_pick_mmap_layout(mm, random_factor, - rlim_stack); /* * Fall back to the standard layout if the personality * bit is set, or if the expected stack growth is unlimited: From patchwork Fri Dec 17 10:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684219 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 79719C433EF for ; Fri, 17 Dec 2021 10:32:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7159B6B0082; Fri, 17 Dec 2021 05:28:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C5AB6B0083; Fri, 17 Dec 2021 05:28:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 566696B0085; Fri, 17 Dec 2021 05:28:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id 488AC6B0082 for ; Fri, 17 Dec 2021 05:28:15 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 15234876F6 for ; Fri, 17 Dec 2021 10:28:05 +0000 (UTC) X-FDA: 78926910930.21.35C9D65 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90074.outbound.protection.outlook.com [40.107.9.74]) by imf07.hostedemail.com (Postfix) with ESMTP id 7EF954001C for ; Fri, 17 Dec 2021 10:28:04 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1xPvWKIw4ya0UuYUl1mBpE5bDqDBUd1i1QXZMvd19aMQVnYGLvoRVmmRipB3rzXpNp3r7TNB6uLDUvJS2WwmTIG6JYqDWycWsHSV5VfEscpudKKeEfHxvk4Lb3C6CuwCDGXidh6/0cNdkXkgOIWVzdMDW/kSxyplgEtKoXKYf3C/ZjCtOXkvyR8Q51EFZ8ymtXTlSzKv7HUQTuhzfFQ/BD1YDdXqQKhIZwQ65tFFZficveXVBWTrqQSR+UWmOa9lb0bYEP/TnkGyJoTpghOKsoLbl+XwqTjl4I5RYhhRZE2KS90739DzjQIHx+RjZTAYhrqsSMJQukTHG37lFBPJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ao0J4RtTmJCD5YE4NNN5icIYyoHVg3j5QWKaKWYo9c4=; b=jUjjhreTVVFGpmUksaeymejq4Ur9c6U3nWYRoO9vkE6AriPP0H9unDRSktj+aDc03kMf2aO6JLgIqOUKDUG9n2iNHWazIs5CA5Li/x+tWu25/eGpnCvrwzATB82zl3YRlb64AnZeWbS81zWfy6WutIn882hmpJylrM5VBxmHLHHUuMvapaBgYkMd8XTOZQE4+Fk9yJt1KQa6sWUycu09GSJcjZZKNVHV3Oh4xLmC6XWLVNHCyzSj+0BIQXKv+fzPoQ2Ac+3BAPGtsGaM+vDl42x9m5p/iDkl8GA9qEjE1gggUzoP90J7WUEy0YjTJFL5lbKmYTbxaoOkdR1XDfsRBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0194.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:28:02 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:28:02 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 10/14] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Topic: [PATCH v6 10/14] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Index: AQHX8zDFQ3uuebV86Um/h1R1jR0ImQ== Date: Fri, 17 Dec 2021 10:28:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ecf4a557-1798-4890-19a4-08d9c147e7a7 x-ms-traffictypediagnostic: MR2P264MB0194:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:246; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3ah7PRKfXkjKRobdmKHssoNPNwG/rDT4HJcZCFZfBcTRhI1V3zLYrD0wyeQX39hdK9zdFa16DEMPtWXUFMnp4AGQas6DE1ubnvKgW+3T3BYRTqsSpwgEy/cFBIMa+ovKnVDtZNgF0HT2q62tZlLSAgxIHGo+Nyhu7qBnc+fa+f9JBLMiE8upZMzN/7airiQxySwE4K56F0kFf2Gz8moBylt3n45WJCjjfVaNGzB+AtDxO339nd5D5Iqx9yL07SnqW5SlXlFSmjzjyciU9aIo0/XtMSilaF/lMSM30qlnOpZcuBrJajpe4P44mzsFwqWxfrU6EPRfvaepHjAF3VU576GMxGwLCZdT2QjRxkJk9nYmREe6udr1kyR59VRwonPFuDsiCJHIU6/i08PYDjNp1P9DR9RW9n78Y0RMlwErvR/s2As6PN6lqvqvnD4UlyYkWvgiksjqdfC9kz2G7j8s7/CQ0o44AxWLhBSI8PjYhPeqz8fajTD/Bv94B/Kno00a91tTkdGF7OjRFVC/P3HOVq6MJ9NjhnCxem5qSWU4aAmWVuz+0YRgPhXwqQ/paDIl3J/sN9x1p5cH5a/EBC3xsnVhpvGtzay0wVhDWGL+NdcgjTuckcqqm99IWlMjMSUEAYL+k+HXhWxj3ooMiJ1vPTAXqkGALnpRdGF/z5JsustDBk29A3YtgEyqJACZHny81NfVV3/TECHVFtbeH8pTE+ZoHzOf9fQJRTcB3p2SbXI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(122000001)(2906002)(66476007)(66556008)(7416002)(36756003)(316002)(38100700002)(186003)(44832011)(6506007)(66946007)(91956017)(6486002)(26005)(508600001)(4326008)(76116006)(2616005)(8676002)(8936002)(66446008)(71200400001)(83380400001)(110136005)(64756008)(38070700005)(6512007)(54906003)(5660300002)(86362001)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?MfYe1n+A8Wvj1aS71H+qO3l?= =?iso-8859-1?q?J5iM2HTHdJj/K8YqNKSEq/SFlGbJs8jmukPXwV2+OEYYTU3U5x7ZdQDoNM9x?= =?iso-8859-1?q?WYCamIV9tVTj6KOcG07uBRodgf8PX+D1ltQKiGP9sqheLca57xo6+szqzcee?= =?iso-8859-1?q?5+EgYqM7dMeZ4n1ZZnm074Wz6ZxcsZeeEEps6/48KMFecW14av39Uewfl+ez?= =?iso-8859-1?q?LI7Q2ArjKHNbr6ZsT7pkGQ8ha2DOW3ypq2bb7pplDtnUGRHYgpMlD3OpzA7P?= =?iso-8859-1?q?xc9DfhqpKVMjxRe5V2CWZaAd4WnMBM1eE8ayGLqqsZm8EKq2pVQ0/JNI6B66?= =?iso-8859-1?q?xGWyd9k87QJ4ZVqv8jSFuQq/JnovM+4q86lg0REWd9174H7mk87sytVIahyU?= =?iso-8859-1?q?u2G7VRVRchMmtmYhCLYaWMISeQ2AMM8BdRdxbi4Rv/bf9p37dXkvDX5V9HGq?= =?iso-8859-1?q?tgEY8OtftI+P6EuoNxhAcVp9X3valWb+QUJmzmOl+FDy8hcrrY0BowLEgcnb?= =?iso-8859-1?q?fQzUsHWyANgwD5oyqcE/UfzeNFBEQq2GeYatyAHDQR/eGT7BNe1DNDaluWZv?= =?iso-8859-1?q?yhEjiPcXicEBWEI2cre91y0mcJ8ap9/e9O1xD8UrCVDt4GzaR08232E/JcV4?= =?iso-8859-1?q?eFELj1DQLyOqpJhVp2Wf9A/6mjxzgxpfH0BbG9DLUWSAqoNLFJHHJaV6PbnF?= =?iso-8859-1?q?V9ju+ytt1G+VOtznHrwBTzA+W1XCvNrMdPfuan+wRv2IQjXe+4Cu0HdLI3xJ?= =?iso-8859-1?q?TYyFBI2r5gg9MPN62/XUlhsnIFZVaM1F287k6UJJ54o7Db9gBaIqV5Dsk6kB?= =?iso-8859-1?q?XRddDdPOINX8+U5fjJBUAuD7NZAtNiDqdsLPRZBIe0LYLRxBgae7xLp/4yQC?= =?iso-8859-1?q?ilTtwBojgiWT1gGIL3kdYtoSfWb3D2cXZZ+UoBfvmywOKW/6vA3alwej23wy?= =?iso-8859-1?q?yDw50p3h74Kj3ujTiha0bmElvDDMoTqzJugJ18P7x30j1i1gmUAr+bPg875k?= =?iso-8859-1?q?WXCIV67430zeimEMuGpYLyg1c6rp/1qMf2UAFlNEo6oat6TElLZOumk/1RwP?= =?iso-8859-1?q?Nd+xNnbpNWT+DVJNRo3X74qW8M3UittnmjjJ76bB1SKdl/oS9Pc3QAIZoxS3?= =?iso-8859-1?q?mjCLtp3RU6hED1m7WSSaqEPYpTkL4jx4vWURQJdLV0HT8s2SKxJYgTKVY9Ug?= =?iso-8859-1?q?ihtyV3FMG4LzjZmdb80d3oTyvQ87qaHn0DQmBiT0NmbAyyP1+R0nCcDTqKn+?= =?iso-8859-1?q?ZcOkm98w9bpyzUIUGhvM9n9Sf0cknxtpPXO5gR0cqHtnr7S0LD3z6R7MFP+G?= =?iso-8859-1?q?yDbWRM6GxyE9BwflO7QLJecfQtqHp8u7WVmG4RuWJTB0EUf6gwL9E6q67Q1C?= =?iso-8859-1?q?MR6KBltZZQfs0L6a9qYAqmgaa7IYGhW1luaX78dUoaxJuK/e6O/IYiOcYgmh?= =?iso-8859-1?q?wQYohKTTUv5qwsIgZitiAGwZcYAExQ4NplUaN49B6VPSe4SJUKGhnapPsOGh?= =?iso-8859-1?q?7vt0wSZFNQ+nJ6sJ/IR5hZ6THS73PvUD0OWD64Bh1wQr/leL1micPWhDpUYE?= =?iso-8859-1?q?42YI8dqETZqwWXUWkuy7xRg2oZ95fKmXPIMsFEnxw6LKbs+gOMufb/3YN2tN?= =?iso-8859-1?q?O2G6h5nEAS/v5fJzYSV6LBV4jJ1yAcO+sPPxpXX70NFTVp5+aCMwsWoy8quc?= =?iso-8859-1?q?swmXjv+G2LyHHB/PZ8DetYMh39aC2YKqwvbxqyuUVQ/l/ue2qlEWr50B8mjh?= =?iso-8859-1?q?gKV8=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: ecf4a557-1798-4890-19a4-08d9c147e7a7 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:28:02.2337 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qVvgAu3aAd0aaqrzKZlZk9DyeMfD8Q1qRIqWQaywCE7pi0X0vlm4WotckxdEcj5NDQUBmK7mDX75fNr4BzXTAuyN5PohTWwFglxOJRsLsTY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0194 X-Rspamd-Queue-Id: 7EF954001C X-Stat-Signature: 97b6qneszwstxnfor67yby1n7mgbpe6n Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.74 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-Rspamd-Server: rspam10 X-HE-Tag: 1639736884-238977 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: Use the generic version of arch_hugetlb_get_unmapped_area() which is now available at all time. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/64/hugetlb.h | 4 -- arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 55 -------------------- arch/powerpc/mm/hugetlbpage.c | 4 +- 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h b/arch/powerpc/include/asm/book3s/64/hugetlb.h index 12e150e615b7..b37a28f62cf6 100644 --- a/arch/powerpc/include/asm/book3s/64/hugetlb.h +++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h @@ -8,10 +8,6 @@ */ void radix__flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); void radix__local_flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); -extern unsigned long -radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags); extern void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, diff --git a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c index 23d3e08911d3..d2fb776febb4 100644 --- a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c +++ b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c @@ -41,61 +41,6 @@ void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma, unsigned long st radix__flush_tlb_range_psize(vma->vm_mm, start, end, psize); } -/* - * A vairant of hugetlb_get_unmapped_area doing topdown search - * FIXME!! should we do as x86 does or non hugetlb area does ? - * ie, use topdown or not based on mmap_is_legacy check ? - */ -unsigned long -radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - struct hstate *h = hstate_file(file); - int fixed = (flags & MAP_FIXED); - unsigned long high_limit; - struct vm_unmapped_area_info info; - - high_limit = DEFAULT_MAP_WINDOW; - if (addr >= high_limit || (fixed && (addr + len > high_limit))) - high_limit = TASK_SIZE; - - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (len > high_limit) - return -ENOMEM; - - if (fixed) { - if (addr > high_limit - len) - return -ENOMEM; - if (prepare_hugepage_range(file, addr, len)) - return -EINVAL; - return addr; - } - - if (addr) { - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (high_limit - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - /* - * We are always doing an topdown search here. Slice code - * does that too. - */ - info.flags = VM_UNMAPPED_AREA_TOPDOWN; - info.length = len; - info.low_limit = max(PAGE_SIZE, mmap_min_addr); - info.high_limit = mm->mmap_base + (high_limit - DEFAULT_MAP_WINDOW); - info.align_mask = PAGE_MASK & ~huge_page_mask(h); - info.align_offset = 0; - - return vm_unmapped_area(&info); -} - void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t old_pte, pte_t pte) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index f18b3a1d18f0..bfd7f4af1e58 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -553,11 +553,9 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { -#ifdef CONFIG_PPC_RADIX_MMU if (radix_enabled()) - return radix__hugetlb_get_unmapped_area(file, addr, len, + return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); -#endif #ifdef CONFIG_PPC_64S_HASH_MMU return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); #endif From patchwork Fri Dec 17 10:28:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684221 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 05A54C433F5 for ; Fri, 17 Dec 2021 10:33:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7EE76B0083; Fri, 17 Dec 2021 05:28:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CE0206B0085; Fri, 17 Dec 2021 05:28:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE4C56B0087; Fri, 17 Dec 2021 05:28:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id 9C2E46B0083 for ; Fri, 17 Dec 2021 05:28:21 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6B453180C3C7E for ; Fri, 17 Dec 2021 10:28:11 +0000 (UTC) X-FDA: 78926911182.16.25A80D0 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120040.outbound.protection.outlook.com [40.107.12.40]) by imf26.hostedemail.com (Postfix) with ESMTP id 3D830140016 for ; Fri, 17 Dec 2021 10:28:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oj4WaMHDie+k/jFA6cDTuNQceOOHHcPIsvVlATUAdVnzTLzvuyJb07Vq3+tdNHuP68lI4Dw+ni4jlq0A3u6nIaTMRumtlvxlTlYLk75+Cpz+8Cz9lqQaTSaAfOb0G9svklUaXKpwebpEbj8IAhPS0oOqneR2O2Z1g+6G6dlOZrJxzT2aKICVyK6OsNX1m05KSjfcpPB6uyTRd0ticof4QzILT0KgPTasPRnQ6XEOCo0Z+6GkYX26OD5RnXxdmQWi68kmkjGFkW5bBhZ2RGLJaTgiLW7NE1TAxCs/X58tXwYjTEvvzowFnh8Y85AP3LbU0jYyaBQgwg97eaTCkJUYMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FdCjHKP9l9OBJ5gDlZQo8deltmcwCmBmFWj0cSPtgCE=; b=WoEtlLTnChvKOx6ah3mb57cqAgqRSEMeli7CTHJcQfpv5txgf1deaCYDCqzKsUpvpk8aLUQwXtDGm41RKgYtO0n3LJKZ7RxWb/xElC+8NaNlGr3FvaEuZYqUnDwczmvKfWt6qZO/0XUo5Ab0i0oUZAe6eDLI7GzvwfLPlMjTg5vhocM7K8m5X4j8ri06sPilt45FsjBAzUGUJcTzn9hKgyCcyjjthPpJEHLepLuCZPiHiH14E09ei1pA953Kli3DRsK6G+uPPWbvBmqF4zPFclCICvPJOXEMP90xdg3xApl7mXWy8oD2yRe1GkIfT4+52ewJGP9UE+dn4CRZh8hi6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0146.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:28:07 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:28:07 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 11/14] powerpc/mm: Move get_unmapped_area functions to slice.c Thread-Topic: [PATCH v6 11/14] powerpc/mm: Move get_unmapped_area functions to slice.c Thread-Index: AQHX8zDI/14Dl8nBOk2wrm2wRtwUxQ== Date: Fri, 17 Dec 2021 10:28:07 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0edcadce-fd1f-48ad-bad5-08d9c147eaf8 x-ms-traffictypediagnostic: MR2P264MB0146:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: q7B1mFfCyWA2Nt/7Y6C8T+wSmRm6dKy9c500w7/NgJO5zO8owcIBW+WKu3C62V6p5a4rD557pvyXbfzzdtQDSwLuRNmTPf/f5DD6VoNa+KsJOz7mnbtLkKtDrT32TclC/W5GRyKGK20EBd+iewmo5ZLBsVvwAt3T87MCehL6gfl0WPAmpZzC2AUeb//jA498BxL2/YZZybUbTuDhsrMN6uoRcAKRjS24byg+kGAfxt9Ch/PHZJiKs8ORWxpzReuSPVRbQCDx1PzsuBku3BvccjLNm+mPsppQD76hpLA2vjODwqn8sSdNPhEruB16Rv7pXwH+B0Vej09DVUPg9d+La7jSwgOtrX5numdj6aWsLd55z/0Bn6E+wqWZX0YmSAj2s2o/g3KHj8i7TU7o7rBIgAbdvp+anmUkvbGPH9VCeWniX+6BewELt//Pf1dCzM3OQpn/5CKxcyVI1VF3F/SHYUzFaNxzbP9svHmIBTEHlMCYvXgic/70rs2GCLjTogTpM4NFl0KKHt1I++CzUftvM/ux2wUfd0yHNFD8M6t6Y6AFxpvlUCML96yigUBG74sCm+aKx/QA/LgGQH9K2WHjxi3fFL9gKmM35mtP4AogrosHGjz2XcY5at/nJINg0dloSfLAreTXjw63VXaGHt7pnXsBKPWvWgfvXRXM7t9sWAEnzE2l0HviNPF+WBjeen/BMxMXGP3fvmle04cDrOnhjw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(91956017)(71200400001)(86362001)(83380400001)(66476007)(66556008)(66446008)(2906002)(64756008)(38070700005)(7416002)(44832011)(6506007)(76116006)(4326008)(36756003)(26005)(2616005)(5660300002)(122000001)(8936002)(38100700002)(508600001)(6486002)(54906003)(110136005)(66946007)(8676002)(316002)(6512007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?AwH+UwICfGArYmEv4UQYEHs?= =?iso-8859-1?q?gXiFTtJpQILGSuc1m5Je1aZroqoqJ7CBt6o1HoV3ArgcCm2h1/CK6gJDff17?= =?iso-8859-1?q?QGHaj7ypKej96NtcmUk5t0jNxaGyEbF3Ua9+7KcBM+raG8QACgFOykZUB/K5?= =?iso-8859-1?q?6NC3dQCG+UH71ti3XZ5YTBRkk3Wd6fwwNzHIc0NWZSsPVLVDQ3i1icONDhJ5?= =?iso-8859-1?q?8IIHk/2sWXL4qmBm5Y6QvTH7U3RA5Hu/2HeO04LscuwQdApxf4LzslYxQO4O?= =?iso-8859-1?q?2twzOk/wily4f4TH30IFkYH2NyBC54k9OZKeAWXT0Nq5BkZI8HYV4fmV4s4w?= =?iso-8859-1?q?i5DZnyz/FUAFKfGRjkxCr2hlXtP9VV9mP1Guplfn4lNheNIBR7aMcoZISKxK?= =?iso-8859-1?q?0/siih5bBpBHfGGCgoklUkwsdsiSlXesfyWbKKuHB1K2Hnt4hY1M1/KT/5WQ?= =?iso-8859-1?q?IfTGYgdNDxrXlUbx2CjP9wQk3FezZTNxvmkrqa83Aafn0Vogmg2ocHIBveia?= =?iso-8859-1?q?bmLV4DrSsQyaZ6zTVR4Z4XI3uJrUnI3Lgds+jNSJ313LzPJP9yY3IDNPFXjw?= =?iso-8859-1?q?zFsPJ0DPLwJD6AfsUQYmkrksmv4uZppEr+nzqQhTIOWiU50z/CezD9iZBRiF?= =?iso-8859-1?q?6s51q09vyntIHopsD6fNuxvabmSHlwCUz2aDniNZAX2qmeEodJMIt+XdMVzD?= =?iso-8859-1?q?IksN7l3GYXi58+LGeIvK0tykcaa/+evar9S74J29yQPZwIHOFTAMDSBL9ucG?= =?iso-8859-1?q?XlyAXTbckONZMC3xOylJguPCKmS9rOg5WY1f87eRXv+2e2Ma0gOeEbvXv+Ax?= =?iso-8859-1?q?UbSx/oidGj8P28wD9UVa2WQOPckqR698xbma/nTVgGy8R0+bGT+yJ+GKSGsN?= =?iso-8859-1?q?SmvsGcAZQ87oeCDJgljdpWFuJ5ba2juVoAcdrc0HASGWuVe+8OTzzqajU5+s?= =?iso-8859-1?q?ep7FR3vAliDRCCgUf5UasEQ6RkUDGBDA5z6HFfW/XwNXMxoTi00UwP0oxer+?= =?iso-8859-1?q?EmuJLp3JbIal/w4RwHXkXL8oxFYib28BXDfUQ1XLy63BS0RyX6e59+O2dwlO?= =?iso-8859-1?q?2EMuqHHO42XcLjdFZkzEfgVZ8Qip+QLLfS+dSnyBbBKsG0bE/qcUBXE3OZk/?= =?iso-8859-1?q?6F30KFZXVN7vqVWNzsFvyKr3S8JjWsRJkXIOfbN+37bxEh8tSaksD5J6Z78O?= =?iso-8859-1?q?9TdcsJ4ne0+rKPcjchdIMsNkOMv8oR5zzshOzcp6oO/awKkn0ujxpQxwUtqL?= =?iso-8859-1?q?rTNPbXKi+hLEP/Cyb7tWDTxphzbC79QuKa8SRMSNS17/1j+ymGEvP6W8S+lM?= =?iso-8859-1?q?9yu6yvO5EJ059cEcy/qFfvVM8hv/fYGGj/Xh8daftNBaAwQZ2mQQUR0ZFp9O?= =?iso-8859-1?q?WmqzyTSt1L4smC3PdVw3clb793hCik87Le7XadIz2zqiEfTaryQXDEwYtdQ+?= =?iso-8859-1?q?J8xZs0ssLY5ZuGSlDIGxVcjbSe+0R3IXFEUt7gFY8Wviry4cFg4cb8hn0I6U?= =?iso-8859-1?q?D28nV3HjS+gdCfrX0PfpFSkEtpA9cVTMBxGwhHo1nPf5H6xRqViRh7SSwWoC?= =?iso-8859-1?q?JsyDNTTapcX9wrZsOZziqwLn6Y84d5gT1F5EzRe0aJhYiVexuCgz6uSErvX7?= =?iso-8859-1?q?D4wr7oyfmBC59/99CZ/00j1fj7JxgHwZl7N1a8D7d4AALpL2mf+ngOtML0HP?= =?iso-8859-1?q?8cffxrhHDCfqjYWC1Jon6LjPX5A4k+1QLyPoR8fSFHAK1jyhehiGGNVgKFY1?= =?iso-8859-1?q?dAzM=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 0edcadce-fd1f-48ad-bad5-08d9c147eaf8 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:28:07.7862 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cGDDHUEs/9mMLX5YWldlzB13M0N9E9LimFds2EioJsxNWcUiI+W/Toboiaj+HX2GT4jhFGqF5zv+d4NKhUgwoNV79MhOOaYf+/Q7PpFAChg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0146 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3D830140016 X-Stat-Signature: f5xrx3ry4jubh7ejc4rrg7dsc9thhnii Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf26.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.40 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1639736890-691297 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: hugetlb_get_unmapped_area() is now identical to the generic version if only RADIX is enabled, so move it to slice.c and let it fallback on the generic one when HASH MMU is not compiled in. Do the same with arch_get_unmapped_area() and arch_get_unmapped_area_topdown(). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/64/mmu.h | 6 ---- arch/powerpc/include/asm/book3s/64/slice.h | 6 ++++ arch/powerpc/mm/book3s64/slice.c | 42 ++++++++++++++++++++++ arch/powerpc/mm/hugetlbpage.c | 21 ----------- arch/powerpc/mm/mmap.c | 36 ------------------- 5 files changed, 48 insertions(+), 63 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h index 7fee46e50377..310ca3597d58 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu.h +++ b/arch/powerpc/include/asm/book3s/64/mmu.h @@ -4,12 +4,6 @@ #include -#ifdef CONFIG_HUGETLB_PAGE -#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA -#endif -#define HAVE_ARCH_UNMAPPED_AREA -#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN - #ifndef __ASSEMBLY__ /* * Page size definition diff --git a/arch/powerpc/include/asm/book3s/64/slice.h b/arch/powerpc/include/asm/book3s/64/slice.h index 5b0f7105bc8b..b8eb4ad271b9 100644 --- a/arch/powerpc/include/asm/book3s/64/slice.h +++ b/arch/powerpc/include/asm/book3s/64/slice.h @@ -4,6 +4,12 @@ #ifndef __ASSEMBLY__ +#ifdef CONFIG_HUGETLB_PAGE +#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA +#endif +#define HAVE_ARCH_UNMAPPED_AREA +#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN + #define SLICE_LOW_SHIFT 28 #define SLICE_LOW_TOP (0x100000000ul) #define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT) diff --git a/arch/powerpc/mm/book3s64/slice.c b/arch/powerpc/mm/book3s64/slice.c index e4382713746d..03681042b807 100644 --- a/arch/powerpc/mm/book3s64/slice.c +++ b/arch/powerpc/mm/book3s64/slice.c @@ -639,6 +639,32 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, } EXPORT_SYMBOL_GPL(slice_get_unmapped_area); +unsigned long arch_get_unmapped_area(struct file *filp, + unsigned long addr, + unsigned long len, + unsigned long pgoff, + unsigned long flags) +{ + if (radix_enabled()) + return generic_get_unmapped_area(filp, addr, len, pgoff, flags); + + return slice_get_unmapped_area(addr, len, flags, + mm_ctx_user_psize(¤t->mm->context), 0); +} + +unsigned long arch_get_unmapped_area_topdown(struct file *filp, + const unsigned long addr0, + const unsigned long len, + const unsigned long pgoff, + const unsigned long flags) +{ + if (radix_enabled()) + return generic_get_unmapped_area_topdown(filp, addr0, len, pgoff, flags); + + return slice_get_unmapped_area(addr0, len, flags, + mm_ctx_user_psize(¤t->mm->context), 1); +} + unsigned int notrace get_slice_psize(struct mm_struct *mm, unsigned long addr) { unsigned char *psizes; @@ -766,4 +792,20 @@ unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) return 1UL << mmu_psize_to_shift(get_slice_psize(vma->vm_mm, vma->vm_start)); } + +static int file_to_psize(struct file *file) +{ + struct hstate *hstate = hstate_file(file); + return shift_to_mmu_psize(huge_page_shift(hstate)); +} + +unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + if (radix_enabled()) + return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); + + return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); +} #endif diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index bfd7f4af1e58..eb9de09e49a3 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -542,27 +542,6 @@ struct page *follow_huge_pd(struct vm_area_struct *vma, return page; } -#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA -static inline int file_to_psize(struct file *file) -{ - struct hstate *hstate = hstate_file(file); - return shift_to_mmu_psize(huge_page_shift(hstate)); -} - -unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - if (radix_enabled()) - return generic_hugetlb_get_unmapped_area(file, addr, len, - pgoff, flags); -#ifdef CONFIG_PPC_64S_HASH_MMU - return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); -#endif - BUG(); -} -#endif - bool __init arch_hugetlb_valid_size(unsigned long size) { int shift = __ffs(size); diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 46781d0103d1..5972d619d274 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -80,42 +80,6 @@ static inline unsigned long mmap_base(unsigned long rnd, return PAGE_ALIGN(DEFAULT_MAP_WINDOW - gap - rnd); } -#ifdef HAVE_ARCH_UNMAPPED_AREA -unsigned long arch_get_unmapped_area(struct file *filp, - unsigned long addr, - unsigned long len, - unsigned long pgoff, - unsigned long flags) -{ - if (radix_enabled()) - return generic_get_unmapped_area(filp, addr, len, pgoff, flags); - -#ifdef CONFIG_PPC_64S_HASH_MMU - return slice_get_unmapped_area(addr, len, flags, - mm_ctx_user_psize(¤t->mm->context), 0); -#else - BUG(); -#endif -} - -unsigned long arch_get_unmapped_area_topdown(struct file *filp, - const unsigned long addr0, - const unsigned long len, - const unsigned long pgoff, - const unsigned long flags) -{ - if (radix_enabled()) - return generic_get_unmapped_area_topdown(filp, addr0, len, pgoff, flags); - -#ifdef CONFIG_PPC_64S_HASH_MMU - return slice_get_unmapped_area(addr0, len, flags, - mm_ctx_user_psize(¤t->mm->context), 1); -#else - BUG(); -#endif -} -#endif /* HAVE_ARCH_UNMAPPED_AREA */ - /* * This function, called very early during the creation of a new * process VM image, sets up which VM layout function to use: From patchwork Fri Dec 17 10:28:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684223 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 1E6BCC433F5 for ; Fri, 17 Dec 2021 10:33:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A9BB6B0085; Fri, 17 Dec 2021 05:28:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 231526B0087; Fri, 17 Dec 2021 05:28:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0842E6B0088; Fri, 17 Dec 2021 05:28:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id E9CF06B0085 for ; Fri, 17 Dec 2021 05:28:24 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B272189118 for ; Fri, 17 Dec 2021 10:28:14 +0000 (UTC) X-FDA: 78926911308.30.8380024 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120042.outbound.protection.outlook.com [40.107.12.42]) by imf31.hostedemail.com (Postfix) with ESMTP id 5767020009 for ; Fri, 17 Dec 2021 10:28:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FyNkiVRke2J1xKlBnHOKZw3/92E1Hko9kPm5Bchy9eJP4AU7/hy5Kdg77FqNJkWGJD8gU0kKSHjPnyvh9hnou1zOot63MVf10utrZGCTdKl8D2aDsaALBab9kAEzUbRvkEg03Bq09gBsOfZ2GZd85OTA2G4vbyq4xyxzoGE9STQQ42hk/ijJj56SZq8RtmvAznd8tNJA9vrbCZ9hNpevfPv1lQS/lWqRsypAfla5uqo/dVgfYyLFimMCuxf5rv0HzO/us1bMMaWoMV+dekvyo1HnTfGtYCho4Fz+MNzD3eEcKLdjU82kla437TRFIjj1WjYspoyXzBlaa0vougdvLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PM1tsV2E7+/dx7vpR2aV9rqndz5KU8OyEwLYpGyZ5i4=; b=Fb71TIPa4s5aUA+ZwwH7Gy4PWjgftazMb7MRrkfGw7iOrPBlIZqx2/qn4bpQsR95ITF8GIVSjVKmbrUIVLR/04y4NHrs1TSR5kUQXQsnx2PV+ghjAPL8yH4byhiVOJcav+80ZZRP1V2cbZZN6TPhEfDIwEm2K/IDc8g+lyeyqHKZtrJMRIAE80QqqrlkRdQZvghZtRuhHzddICxz3sd4kPWJ1BqDSYnkKClEKnUUBYQ5F+NB2lRrvBXRUwt37RTLM++yE9S7i9L7fSO2hDu4t8ezBwKtOMN9o4tn0aloEhJJCkE5QCXMqx/N2QHYfG4utsd5bwl3GLYSSbAnZFiYRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0146.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:28:12 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:28:12 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 12/14] powerpc/mm: Enable full randomisation of memory mappings Thread-Topic: [PATCH v6 12/14] powerpc/mm: Enable full randomisation of memory mappings Thread-Index: AQHX8zDLLCiS7XjV0k2/ODdJkMHmPg== Date: Fri, 17 Dec 2021 10:28:12 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 522cd451-6b85-45f7-5c94-08d9c147edea x-ms-traffictypediagnostic: MR2P264MB0146:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2887; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LnsmmboUaiK9s/wOIRSLQAfAV7zRsFWHVe1lNvsf8iKPWgwVdAeTGsYODfR0KZh4X0IHBiWX+Jm/rQKDcINm8JHsHaisZmCc5UBf4xc1VSXoMCwVNbyAaavcQhTN53qP9bC7qi4AFCEnjEvSezmlk1zd5wRGCS/UJwcMWWW5C+DWa/07g52JIVkT6lLUHorjfnR6icGqVzA/AboWCeS0LmgDqktNw7LbOYN9YBNjrd5bFfnv/d8tFIaO8KxY/dUGiRP8fWeNPSSJtklbC1CMzk9g5h0M3GVr3w+yn9/LSy7iBzRpaK3ylVL9nzLvxnfOybdGTeWZCbUzoIL+mdMo8aLkkjOrQjinVvENhkn+N2idR9fxUnRHnD4qo2FKl1Zk0871ZvXo7oyfoT6Mk+7P30nGuIEcfYij8fufZRMHvRgbO+gE/q8strvsBvSpxu5jgPjHXbLrFYqfEuvTKw+AsMOWeAmC1lIKqXq77fsjWJFwgKopOEiar8m39FBdWE++8scY3BBbomMpPPyH0kaQhLUURA1K3uDMDj7/vz8i+1NGzZ34G8vBQiZtcmxcDVehYfdTQ5+E8aOz+bw0tmefN2E1hzwcFQNHWN5/+Ek8pXJN8VF5rM67LF3qyQz0qk43m1QpufSMYe9Fpfex0ZomyO6oH+FVxExyEhEeAlNnKKAR51QW3aH69Btyaku2TK98XV/k5Q4nCm8X8VQgroB+gw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(91956017)(71200400001)(86362001)(83380400001)(66476007)(66556008)(66446008)(2906002)(64756008)(38070700005)(7416002)(44832011)(6506007)(76116006)(4326008)(36756003)(26005)(2616005)(5660300002)(122000001)(8936002)(38100700002)(508600001)(6486002)(54906003)(110136005)(66946007)(8676002)(316002)(6512007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?EK+Qv0TpiNOrqIL/pQsYenp?= =?iso-8859-1?q?/vFBKv+6z9YyxcR0CGrTUu144keSw5RWe3NseLp3O+8tQTjCD9rTCItafofl?= =?iso-8859-1?q?2ywimy5km7YXSa1vliwlmfdKreaor8q08+ewBjv7K9A2E2TUsKHG0FQF0YyI?= =?iso-8859-1?q?aEBY7KpxmZKnmR5lTbSVy0I88sh8u895jikXBUjzRAYnYL3AAIGxwjAPrmJ+?= =?iso-8859-1?q?4qku+ekAhwy6k798A0n0CznqAGtPasTRFQ/s7aJZr4YG9e/ljt7gpx0mlp7p?= =?iso-8859-1?q?KwgMcO5KgxjP1EyRG9Hl/hd8UythBMKyH6O9YW2DTYykUrWkjKt66d9WDO1X?= =?iso-8859-1?q?w3UhfQvfrBwf3hHfeHrpS9+DlVwt4o3E9SpVJFnqdCnNDYCerVbnYONlMscS?= =?iso-8859-1?q?mia1/DFDK1tlW7uHraI034fTAbPOKc+uib0rRAuXYpH/nJFBajIofUmhfbw5?= =?iso-8859-1?q?HoxWrJIcUnEufZ0QJusbQvJY9nQwBwmTsTmTXoWh1etYX37EU2X4yqnPIc4O?= =?iso-8859-1?q?aOYgVuyt/vJ3u8upXypozDLEnHkF7VXPmFTM4lBDVnm8125kcheZPEDZUjGM?= =?iso-8859-1?q?+RgOjQwmga/ywzlipD09D10fgLj/NDFZ+ISwkSNkVtBvY3MLRMO0sE/1Pw8v?= =?iso-8859-1?q?Lq8dXAz3gpj3Bsi5rhz5y+3qJwZm7Mc2YFqSBLeIGIIr5ioqUfBYQJPzFPAc?= =?iso-8859-1?q?mZIElL0/dPmJOhVorhRVzhxEomIAENsCmUTNwoQb66DSKWDzdukZwv6RyIps?= =?iso-8859-1?q?nxZ5Ks99Ah/HqiDhJrc5MdjLS6RRJwgOtLy7F8FZsWlQPmWFg15uik+bGjvL?= =?iso-8859-1?q?LuAVOdilL83gjWRyFIDEEMCOGeK8/b3LCSoseMDp/q0YgAOOiTa8L1NrymqH?= =?iso-8859-1?q?1rMBqkD8J2P7dqdS22sXPS89Hlj4mOyj8fSLz3+SBfmACwWr5ucgh61qoKS4?= =?iso-8859-1?q?Z+xrOGa2WGVIhs80D7ktKnjvNN+d7lW0susFtsmjNJPYwE6yg1vUFzJ/WG2i?= =?iso-8859-1?q?TqD9v+GHrf+U5kQoic8Lmzg7UQm2bgNNJy2aHSzKOpM78dLdI0ZqDdfZ+l3h?= =?iso-8859-1?q?SJ6fHoy5IGnqRtkFojAHYHG5sfX51wsIbWm2E9M64ZBb2WWBd+Z08kfy62r2?= =?iso-8859-1?q?ACM1nrlBV/Y9NiL7VRoTr6p2q2gorn3CGbq8VuQlHb52t2GrV0jV1f1fWBf9?= =?iso-8859-1?q?dLcPY293Kl787VejWV6h+tSkBCiyHGSL5nKBmm4Jk25inGT0eO43R8wGN++A?= =?iso-8859-1?q?q2wuIeVwzC8jjlB+oAXvX5JuLO8Zr/y+1FiPs8yOapkE0o45fH1RC+tGSs7U?= =?iso-8859-1?q?7Q4L1yRBtczM04Q7VlJMt3p9TcKC/hqv0i9m4eD6fYFhKsWDuMC9ivUFq/LC?= =?iso-8859-1?q?ynmxzcAs7nod2vLUxeuH0TabrBRzGWCIF5MscNqMgFjUa0AjyhggW2DpL9Bg?= =?iso-8859-1?q?Qt2Ai8efnJRFb8kVJ66KEFd7yqr3T04fjfSKNYqPxV54/zwCSXjhSzSrKgEA?= =?iso-8859-1?q?VG66I240skCFDmW+l5yjApleSGyKcGcQb8n1tUG5ZEvJgT1WbCkJ9F09zXQC?= =?iso-8859-1?q?chIl+xKlTUL0bbVgEXp80mhi7D/5zz2CEIYtHBZr7NfgAy9ZiVHIp8A+yUL5?= =?iso-8859-1?q?Ohw2GvTL76WsENVrbKkyYDJT72x4DiJIRYabeDQ46RdXzrRq4S8A7BAu/LM1?= =?iso-8859-1?q?pwzIbJdv7Z86tPX5dwvND6BZR0eFVQtlzP8xkwzr9OarP6lNZxSVEK6KETZA?= =?iso-8859-1?q?f3b8=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 522cd451-6b85-45f7-5c94-08d9c147edea X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:28:12.7252 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pa4WcehptrpkrFq8k/qD8f3psE3PYPFbGGiqOXxobK+zXURVkNme9OFbw5YUmlEkhnKQvzluoN36PkpPE4ggHbnSquPqR8EgWoubqghviiM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0146 X-Stat-Signature: xw17sdn9iiqfho3rh7ouazfeubtdjh11 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5767020009 Authentication-Results: imf31.hostedemail.com; dkim=none; spf=pass (imf31.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.42 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639736886-205537 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: Do like most other architectures and provide randomisation also to "legacy" memory mappings, by adding the random factor to mm->mmap_base in arch_pick_mmap_layout(). See commit 8b8addf891de ("x86/mm/32: Enable full randomization on i386 and X86_32") for all explanations and benefits of that mmap randomisation. At the moment, slice_find_area_bottomup() doesn't use mm->mmap_base but uses the fixed TASK_UNMAPPED_BASE instead. slice_find_area_bottomup() being used as a fallback to slice_find_area_topdown(), it can't use mm->mmap_base directly. Instead of always using TASK_UNMAPPED_BASE as base address, leave it to the caller. When called from slice_find_area_topdown() TASK_UNMAPPED_BASE is used. Otherwise mm->mmap_base is used. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/book3s64/slice.c | 18 +++++++----------- arch/powerpc/mm/mmap.c | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/mm/book3s64/slice.c b/arch/powerpc/mm/book3s64/slice.c index 03681042b807..c0b58afb9a47 100644 --- a/arch/powerpc/mm/book3s64/slice.c +++ b/arch/powerpc/mm/book3s64/slice.c @@ -276,20 +276,18 @@ static bool slice_scan_available(unsigned long addr, } static unsigned long slice_find_area_bottomup(struct mm_struct *mm, - unsigned long len, + unsigned long addr, unsigned long len, const struct slice_mask *available, int psize, unsigned long high_limit) { int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); - unsigned long addr, found, next_end; + unsigned long found, next_end; struct vm_unmapped_area_info info; info.flags = 0; info.length = len; info.align_mask = PAGE_MASK & ((1ul << pshift) - 1); info.align_offset = 0; - - addr = TASK_UNMAPPED_BASE; /* * Check till the allow max value for this mmap request */ @@ -322,12 +320,12 @@ static unsigned long slice_find_area_bottomup(struct mm_struct *mm, } static unsigned long slice_find_area_topdown(struct mm_struct *mm, - unsigned long len, + unsigned long addr, unsigned long len, const struct slice_mask *available, int psize, unsigned long high_limit) { int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); - unsigned long addr, found, prev; + unsigned long found, prev; struct vm_unmapped_area_info info; unsigned long min_addr = max(PAGE_SIZE, mmap_min_addr); @@ -335,8 +333,6 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, info.length = len; info.align_mask = PAGE_MASK & ((1ul << pshift) - 1); info.align_offset = 0; - - addr = mm->mmap_base; /* * If we are trying to allocate above DEFAULT_MAP_WINDOW * Add the different to the mmap_base. @@ -377,7 +373,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, * can happen with large stack limits and large mmap() * allocations. */ - return slice_find_area_bottomup(mm, len, available, psize, high_limit); + return slice_find_area_bottomup(mm, TASK_UNMAPPED_BASE, len, available, psize, high_limit); } @@ -386,9 +382,9 @@ static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len, int topdown, unsigned long high_limit) { if (topdown) - return slice_find_area_topdown(mm, len, mask, psize, high_limit); + return slice_find_area_topdown(mm, mm->mmap_base, len, mask, psize, high_limit); else - return slice_find_area_bottomup(mm, len, mask, psize, high_limit); + return slice_find_area_bottomup(mm, mm->mmap_base, len, mask, psize, high_limit); } static inline void slice_copy_mask(struct slice_mask *dst, diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 5972d619d274..d9eae456558a 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c @@ -96,7 +96,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) * bit is set, or if the expected stack growth is unlimited: */ if (mmap_is_legacy(rlim_stack)) { - mm->mmap_base = TASK_UNMAPPED_BASE; + mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; mm->get_unmapped_area = arch_get_unmapped_area; } else { mm->mmap_base = mmap_base(random_factor, rlim_stack); From patchwork Fri Dec 17 10:28:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684225 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 58248C433F5 for ; Fri, 17 Dec 2021 10:34:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D1BD6B0087; Fri, 17 Dec 2021 05:28:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2589B6B0088; Fri, 17 Dec 2021 05:28:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AB176B0089; Fri, 17 Dec 2021 05:28:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id EC3EA6B0087 for ; Fri, 17 Dec 2021 05:28:29 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B21D1180C8534 for ; Fri, 17 Dec 2021 10:28:19 +0000 (UTC) X-FDA: 78926911518.29.FAB26A4 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120057.outbound.protection.outlook.com [40.107.12.57]) by imf22.hostedemail.com (Postfix) with ESMTP id CEC15C0015 for ; Fri, 17 Dec 2021 10:28:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOG7YtgbSZ2v8UaZvjWHppF9mnIrT1bMtE6fcCIUjeSANQmP2lVMhKwB5CiB+PbMSKrHWMlBdf40vN49BqeGUrWxg8KDFdjhQVL1EkcJH5H8VcPUcWqB0Yl1YoQT9I8JvqXVB9EEGyqplccpbzRCnuvZRtJcUMHQu0oKw0D4jU4w98S8H8V3+0jQA8eAcCmZfttTA2zbIEWeYoL8p9/4PVjVik+4X7uSq8yAOLNKuIgR23kHqprbI3eIKRayuMm0crveL6KYJps9F+H2ezKSIISh0XHjO2xk8mvUTgiAQNDfSJ60XzOk0aHx79rZKq9y575B064HltYEbguTZ6r0XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gGFW1HR24WYAEOnV8dd+oFOXUWflLAKM+E2nFCnaGvg=; b=Sb1Arxv8Qx9q4XZj0L/5VvAfQmG3NPdfDrUwgiYeDW7+0OPHp3niYQs51FEvoHlujrFXuhQ8KWa0r4LQE7nD+aigInnG1eZSBAz42uhsTob40Bdxny8M4sz0C6i2QqqHqkp6qzRfsHb3Ir4S3KdZXsTwcCF+mXifkK6WSU2wUrgam8kN2pChxujAgU+6ZiTf10Dn5Bq/nFCk8MA0+wG1y+oS/ESfWQWDL1IoaksHx8dFZTkWb7A0Zp1CW2Qv4rFVPuTk/4rGN6y9tX2UAqCGjaPv5CnluS399xCj8gK2PF4OEtLxQSFRYDHy0rquyyxpzC1Vkdxfw3NEptX35eHM4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0146.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:28:17 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:28:17 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 13/14] powerpc/mm: Convert to default topdown mmap layout Thread-Topic: [PATCH v6 13/14] powerpc/mm: Convert to default topdown mmap layout Thread-Index: AQHX8zDOu32cl/lvLE6oPm2rWLszog== Date: Fri, 17 Dec 2021 10:28:17 +0000 Message-ID: <47ca2616c0fad6e9fa5c6598cde7a43e68a0e5f4.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67d92153-a182-47a7-ff6a-08d9c147f0db x-ms-traffictypediagnostic: MR2P264MB0146:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:311; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gzVloqdRBp6C3mk88ncgXdgpm67knpSS+k8+RE6QSwGj+MpqH/mnyPiZ0zSqqCfSOhMag90M0P83qqe1Z7hshrx4xf+RCrZK8NB1S1K5v7lhf7JAGmULntRN/VHimvRlsoI0OwjGhxnQoMkN37DSXZTJ99qiJwZOTC4zN9GhYHbpvkXDEGOPUfXp/tJzw1iH3EOn3GUkzIahZw1bFVxyP5RbgLj6RMa8JU3kYYftL0BSx9oq08TO6jIFRdLi5eC1iSc0tujPM7F1f9r95rBkEMj6YKrtK0w489wfDU8OlvvGaMvyvNodikU1qpW2K5TSuwV8luvPABMO1DQiGlonXkP3s04RM0nOtuxCwQTlX1RqDDeZupImjd5NbjbwolJae+zR6Sopn3J36FO/KJZJyuR0/aOTMQa40GV7pMAtwHbjPjWDYyHP6mFRlOrOx3W5XIu/YBTXDwHVy2C5anuQ41kwvj+U0kqbQTy1wCPyTN5D4/+KShUdRZhU00iB5hfe1W81aOYyGv9OUn7o/GCSV+prQ3P810lRXqJiP6LYKiMv1S6IZhrm9VAQ45+vLJveygftRh+KlZHFvJ+ZNDXqG6c6SITyy5sBa8ZVtJM3iOgHrl7/WvnQsNQ7z2alkTVmpTHxC+goLT4flSz61Lbr+d9eDKHxMFkkuMXmi/Q3PXi0p9GNIVmQRuZ6ca0t+qc51HpBOnrNqS1duJS1T9RX5A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(91956017)(71200400001)(86362001)(83380400001)(66476007)(66556008)(66446008)(2906002)(64756008)(38070700005)(7416002)(44832011)(6506007)(76116006)(4326008)(36756003)(26005)(2616005)(5660300002)(122000001)(8936002)(38100700002)(508600001)(6486002)(54906003)(110136005)(66946007)(8676002)(316002)(6512007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?8+xiEO3joalqo24FxfAElc4?= =?iso-8859-1?q?RIpC3DV57PjamO0wcjutZhTuPEU7WmT9iXA70Ry7tYUCDB4Zb9ZHecLM1SI4?= =?iso-8859-1?q?N/7/SfPG3nwLLmr9XRQN/KLuss2CdrdQhESH5asWq7WfTv+67yl+5NPkah7X?= =?iso-8859-1?q?ObcVpDq0B/tCUdOk32s3nMjvKp4e/froMsAQ0lR3w/wVY8FqYU6Clj/d8Mq+?= =?iso-8859-1?q?9RKzyRDAEn2ER0A+Z/OhXDmQ+4BnVlK4e8xPgt6tVJ4EImHuh/Axkf+Kg4jc?= =?iso-8859-1?q?4C/O9IvjnxZnCv2cszH3O7mWesj39kV85fi6nVh/e3DnG8wcO7/kqYH8/L77?= =?iso-8859-1?q?X6S+v6O6kZD5D2cBtBLfA72qvEAj59BNYfJ+z3t462tBPwwM5bpGAyjKvuBg?= =?iso-8859-1?q?h1GAIZqhVbbouSqdXKDbYdDiWX83Myk115ZBMS+9To7GuO6ywQBpSMGNfmB+?= =?iso-8859-1?q?RAGqjy3MhNVEkTMga5qChJYiMEFBaZffG7TIpIzE/lkEGclCGvndxjMoAa0j?= =?iso-8859-1?q?8AOyMafjx/wPdvOdzpLPRxoqZ3u/NmN+obStoeeomU7s1D/jJmvPg8jQe727?= =?iso-8859-1?q?3FEZKaI4bV8YOWSnCGLrbbvbVKX3jh6HJsNHhBiEwMxFdF+04YdfyMYIehQm?= =?iso-8859-1?q?OgA6rkEpxKzX/dZy0gWOrYBw/kzNv7TLkh2BTc7Jpv2L/MrBQScV7HSrALhK?= =?iso-8859-1?q?tBkeugrFJjl7JLisOM7WdY7oFd//xFk6XJIzOOJqHfp56ApvKgY7q6dQJ0O4?= =?iso-8859-1?q?t1i9B5wpuJ7OQI6GJe6WL6nr/pifD5XNM6DmuuCOfQ4eCE+zm+ms+XYNWobp?= =?iso-8859-1?q?++mwTb20nQTomC0R1TgKJjRdn6+xxkYpQDf0vGI/m9F0Vuz516j6jenuKwhL?= =?iso-8859-1?q?xAgKPSYcdWpybAGocgb4zWR6yBIvhD8SVcfj8IPEDZzqr6+Hz3cGWK7ocmiE?= =?iso-8859-1?q?xsI37Wqd0EfqiFb0e8tgIoKwr5/29xU72p/0PLnv06j/IVKfHhkDKDwxoR/d?= =?iso-8859-1?q?z3xgMHta5AN0/w7l/a6y/Fqk60SV7teethKDUF60gQ/J2M49uUTzoGV5ioiL?= =?iso-8859-1?q?VNNNdMAzzvmPvJ6AU7E9w7c05YHluXcc+4AG7uNS0neMIylE4h97kNq+4wgl?= =?iso-8859-1?q?/LCYjNVvg11BwdtQMMfObOOk6fY59frn1c+DC3piOkbaH4PjSUkD9E5BqH6Z?= =?iso-8859-1?q?AwGQfhdJM6RMvoAywR+Uv6He8BzK0HAH4VpfJvZWL6j9ZGrW5t4OuOcB9d7U?= =?iso-8859-1?q?tWdnZIVSauMAfF8YLqT1msn6byKH2LiuWNCp5MPqtSJ/nmZ6Qj+8Uyy2fzBS?= =?iso-8859-1?q?xuFlQjRXKrsiIWwd1gHcvx7jKS4RqltYabwcJeGkR29SPyLL2E4wGwnqD654?= =?iso-8859-1?q?U9VrN+p6lMCRV728PNDWpMxoxTjyrgBs7FeG5T0TV51gf6Vc8c+7mgU2CGz7?= =?iso-8859-1?q?fAfugAD5CzSc92t0g0sKoFgBZC3XUonp5ScJJswEgNv0Ijn5+Sk8oFtBnEPd?= =?iso-8859-1?q?Ll4e0MKl0Aqt+Joe7a/r1NkopyR3QeMT6T90qM5S2Kj2ZbqQWb1ZQ7fyHDHA?= =?iso-8859-1?q?X6wMQL4yjxefH1tw/QC04AeS8onhgBgyQJAdW2EB0z3ycDp/FqVxzaEcqFNp?= =?iso-8859-1?q?f9J/1FIt1Ppb5UFlN+iYoTvhtcxufhhyx/lZ0EcmRjuyZqh/o/vf56oh6OGe?= =?iso-8859-1?q?oynwWMHk38ClG/+koJWkNokOa+Dfh0B2gToUjf1UaKoIQhRf2Relj18kGwQB?= =?iso-8859-1?q?jDK0=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 67d92153-a182-47a7-ff6a-08d9c147f0db X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:28:17.6331 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dQ1xKuQXIJrH7AgOMNSv2xJ5EMHEiBaPg1eqJv7Y7t74ouYOjEVu0c7As12j2TBzLL77kP5viW6Y0la09gX4if2c8Sjfk9jeq8SeQhMtX+Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0146 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: CEC15C0015 X-Stat-Signature: sztxst797erng8tahs485soc4617ri8x Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.57 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639736898-176859 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: Select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and remove arch/powerpc/mm/mmap.c This change reuses the generic framework added by commit 67f3977f805b ("arm64, mm: move generic mmap layout functions to mm") without any functional change. Comparison between powerpc implementation and the generic one: - mmap_is_legacy() is identical. - arch_mmap_rnd() does exactly the same allthough it's written slightly differently. - MIN_GAP and MAX_GAP are identical. - mmap_base() does the same but uses STACK_RND_MASK which provides the same values as stack_maxrandom_size(). - arch_pick_mmap_layout() is identical. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/processor.h | 2 - arch/powerpc/mm/Makefile | 2 +- arch/powerpc/mm/mmap.c | 105 --------------------------- 4 files changed, 2 insertions(+), 109 deletions(-) delete mode 100644 arch/powerpc/mm/mmap.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 0631c9241af3..b4ae3d8bde46 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -122,7 +122,6 @@ config PPC select ARCH_HAS_DEBUG_WX if STRICT_KERNEL_RWX select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_MAP_DIRECT if PPC_PSERIES - select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_HUGEPD if HUGETLB_PAGE @@ -158,6 +157,7 @@ config PPC select ARCH_USE_MEMTEST select ARCH_USE_QUEUED_RWLOCKS if PPC_QUEUED_SPINLOCKS select ARCH_USE_QUEUED_SPINLOCKS if PPC_QUEUED_SPINLOCKS + select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_IRQS_OFF_ACTIVATE_MM select ARCH_WANT_LD_ORPHAN_WARN diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 2c8686d9e964..873adaab20c8 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -392,8 +392,6 @@ static inline void prefetchw(const void *x) #define spin_lock_prefetch(x) prefetchw(x) -#define HAVE_ARCH_PICK_MMAP_LAYOUT - /* asm stubs */ extern unsigned long isa300_idle_stop_noloss(unsigned long psscr_val); extern unsigned long isa300_idle_stop_mayloss(unsigned long psscr_val); diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index d4c20484dad9..503a6e249940 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile @@ -5,7 +5,7 @@ ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) -obj-y := fault.o mem.o pgtable.o mmap.o maccess.o pageattr.o \ +obj-y := fault.o mem.o pgtable.o maccess.o pageattr.o \ init_$(BITS).o pgtable_$(BITS).o \ pgtable-frag.o ioremap.o ioremap_$(BITS).o \ init-common.o mmu_context.o drmem.o \ diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c deleted file mode 100644 index d9eae456558a..000000000000 --- a/arch/powerpc/mm/mmap.c +++ /dev/null @@ -1,105 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * flexible mmap layout support - * - * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. - * All Rights Reserved. - * - * Started by Ingo Molnar - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Top of mmap area (just below the process stack). - * - * Leave at least a ~128 MB hole. - */ -#define MIN_GAP (128*1024*1024) -#define MAX_GAP (TASK_SIZE/6*5) - -static inline int mmap_is_legacy(struct rlimit *rlim_stack) -{ - if (current->personality & ADDR_COMPAT_LAYOUT) - return 1; - - if (rlim_stack->rlim_cur == RLIM_INFINITY) - return 1; - - return sysctl_legacy_va_layout; -} - -unsigned long arch_mmap_rnd(void) -{ - unsigned long shift, rnd; - - shift = mmap_rnd_bits; -#ifdef CONFIG_COMPAT - if (is_32bit_task()) - shift = mmap_rnd_compat_bits; -#endif - rnd = get_random_long() % (1ul << shift); - - return rnd << PAGE_SHIFT; -} - -static inline unsigned long stack_maxrandom_size(void) -{ - if (!(current->flags & PF_RANDOMIZE)) - return 0; - - /* 8MB for 32bit, 1GB for 64bit */ - if (is_32bit_task()) - return (1<<23); - else - return (1<<30); -} - -static inline unsigned long mmap_base(unsigned long rnd, - struct rlimit *rlim_stack) -{ - unsigned long gap = rlim_stack->rlim_cur; - unsigned long pad = stack_maxrandom_size() + stack_guard_gap; - - /* Values close to RLIM_INFINITY can overflow. */ - if (gap + pad > gap) - gap += pad; - - if (gap < MIN_GAP) - gap = MIN_GAP; - else if (gap > MAX_GAP) - gap = MAX_GAP; - - return PAGE_ALIGN(DEFAULT_MAP_WINDOW - gap - rnd); -} - -/* - * This function, called very early during the creation of a new - * process VM image, sets up which VM layout function to use: - */ -void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack) -{ - unsigned long random_factor = 0UL; - - if (current->flags & PF_RANDOMIZE) - random_factor = arch_mmap_rnd(); - - /* - * Fall back to the standard layout if the personality - * bit is set, or if the expected stack growth is unlimited: - */ - if (mmap_is_legacy(rlim_stack)) { - mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; - mm->get_unmapped_area = arch_get_unmapped_area; - } else { - mm->mmap_base = mmap_base(random_factor, rlim_stack); - mm->get_unmapped_area = arch_get_unmapped_area_topdown; - } -} From patchwork Fri Dec 17 10:28:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12684227 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 08057C433EF for ; Fri, 17 Dec 2021 10:35:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 800836B0088; Fri, 17 Dec 2021 05:28:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 761396B0089; Fri, 17 Dec 2021 05:28:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58D8B6B008A; Fri, 17 Dec 2021 05:28:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 466286B0088 for ; Fri, 17 Dec 2021 05:28:35 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0292E8908A for ; Fri, 17 Dec 2021 10:28:25 +0000 (UTC) X-FDA: 78926911770.31.70F0A97 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120077.outbound.protection.outlook.com [40.107.12.77]) by imf14.hostedemail.com (Postfix) with ESMTP id 2A6FD100010 for ; Fri, 17 Dec 2021 10:28:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+3N/LfyhqJU6PpPVS6vXk44k6zr+dcan+r4pGDooZMzBiWk1oOj9BkQNpJjpsxxTf3cTXSfAxGYS1qpnEOCUFNQ9LvdX2g4JmgcuA7XvnzgnlHtREe8a0X57yyAnCTaGZb7dzOhehZQwYy4Ch0kn88RYpDKmqdSGtcXM91lSFl8m9MPzL0rnqbvBksEfWlNriM279ojZsMZ4qsiOc91HHRWgV2o5aWWIg2ub0B4C4orU7h2cbCDY4UXNclyePA4aZRED5QDQKH5v8A1c9AGO3lIE+aH84oUnUPI+29el5EscIBGnLzhsXXjGENeYsfnzqt1X/SucFfK9HSGS4jBtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7GCE25qRm2CGxDvHUrHXVel7PPUjK1mixNc0dChnkIs=; b=l3Vfvv4ifluULQPW8L1DQhRBQhsAybsmqdIuj9Zf8gyFa1t5udIvX3AtCsJOsOqyDTPBap4w+Fp8NhYWIDFo0rgkYz8hb+QRhls2x+GfuJVJPjY9XtiiWxG34DPWGemRe8lebSOahs7dzxYBhO3mlii5DIVGBYuBxUKhge0ZTRri0LzLL+PGrkxz7bhEjwlbjOsjHSJmORtBav4yuWRrz+T6ZKZLWmC6G1W3nUtrDTchQNz8VZUgGQqxzOF9kgdiPNyfdQFf4vSmxOj2x/yUjI4JXl9BCZHwP601mVWKzbm7uAkv/7U44pmYqdDaeBEeY4/CepYRPYRenppIc7IJrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=csgroup.eu; dmarc=pass action=none header.from=csgroup.eu; dkim=pass header.d=csgroup.eu; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by MR2P264MB0146.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 10:28:22 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::f0ef:856d:b0de:e85d%5]) with mapi id 15.20.4801.016; Fri, 17 Dec 2021 10:28:22 +0000 From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "alex@ghiti.fr" CC: Christophe Leroy , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v6 14/14] powerpc: Simplify and move arch_randomize_brk() Thread-Topic: [PATCH v6 14/14] powerpc: Simplify and move arch_randomize_brk() Thread-Index: AQHX8zDRiLqEcN60akW2b/fzMqW42Q== Date: Fri, 17 Dec 2021 10:28:22 +0000 Message-ID: <9ccc69fa94297835dde68b30759be7280333c8b8.1639736449.git.christophe.leroy@csgroup.eu> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0267c4cb-a780-428d-1fc4-08d9c147f3a5 x-ms-traffictypediagnostic: MR2P264MB0146:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zSiIrs0adWpAvkdtXDhQHJarAfcVImcnWBb2+znDoEwTEHhFQtLGgO9OP966kcU2IxvspRpYFqpPtNkpX8jOE33HoqioMipVxFVVPJ2ckw62KVOwLTsunjsVaJFcQt3N98uOSr8Pfa9ZSsXT/ibN3gEubwX3LCW7SB9BNwbzuwCXUS5ssatjBEe55NdGyhyokHfkb0Mfk/Ox6gP0pthYgi7ZoRsWQIRkLPWTmLNzKF7R0Muq2uSWrDvKg4mcvvNZlIaovAbjMJsIZNz2xnen4LtxHObmWawthLAgMgjTMGzmz4k8GgwLw29xOVCBbtHgM5EKXg5PfKCZkmFIHAlvc4+MDZnWAAb9WQO5sz3gByJwfDgnEsbUc6UTpm5ykZI4HDeimmXg32+BkxpaH17VB511Ikp4jzxFLNepRXasJ2B/mAyGsQa9X1+c2/MTU4GicSPb8kjen0ymFQ9LVV6nFrbAoarff9zNy5L7iOyKzgv7Ev+wz+PgRQiE771C//yGk3+nHUcBSr4Ery0UMpdIksdo8+RBBYv45hJZQbNkk1YI/uZfwv2yRJoq3blGhVbyC3YbPr45jP1EfttdbFoXcpvHVmCbZwyynRBTmWglokVVSFJj8sL5d4DG6ilfExxY+yweanatKI1gZJQzoP+o9WsDwPhvFwKVrEypNXWqD7mU6TtRNUp2FzZH+ghxnjfpBe54ijLIymn+0soe2/rs5Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(91956017)(71200400001)(86362001)(83380400001)(66476007)(66556008)(66446008)(2906002)(64756008)(38070700005)(7416002)(44832011)(6506007)(76116006)(4326008)(36756003)(26005)(2616005)(5660300002)(122000001)(8936002)(38100700002)(508600001)(6486002)(54906003)(110136005)(66946007)(8676002)(316002)(6512007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?CNCfu/O+ewrU+mOLOSA/Eh1?= =?iso-8859-1?q?QYu9DwABvzZRPWxuDOzHy2Ur4IoPxiKxJZXslRyHg7s/mT1gGwjoFps3y5uC?= =?iso-8859-1?q?FxE1iWmUTfJjDFkAWVRDw90DbkWHCVAFetvMs+qCsIUPhrvTxN9pNeDD4V0W?= =?iso-8859-1?q?wnPtXOTrBFF6+4FIuvAKOQiTO+iHoJ8mt9RbJMOaNzxubaTbdGx/fdFkBgqA?= =?iso-8859-1?q?0Ah2YBt+n7xxNHNFqg+lO+74bvtgLH6VeXpqtkgXtoF96TXtQdH8jsSJFaqW?= =?iso-8859-1?q?zUIDYd28BnpXTJ7oj+dYJZ+B3R9JHKWxO9hUgjhCcqE+tgZ20sq6rJlYYncl?= =?iso-8859-1?q?IzwrJzPOsyByptoQ5qWlFmWrszDJYC5vEk7rXdGblyHAjQFiLQIzd+W+tmWS?= =?iso-8859-1?q?9BhS3QR61vgHuRFjMhkD/ed0AvizCVU8/lRp4SuTmBLF8yEBkzL2wreyU/Uz?= =?iso-8859-1?q?CZ5TVcNKtngk2ebdGEUB8/dHPtHniMO261sxB/py5nZD3daev4aLkYAhs7w7?= =?iso-8859-1?q?8faPzFb7R2Gr0p1G7IjkRp17J6ygz3nhsp4hNQM+3TtP4uecmxiYbvDhoiry?= =?iso-8859-1?q?4NL565t+h/Kxn/61UVp0gCrTXCUJwRu47mRasZVrdsoO3PGaWWrVwPcuF4+E?= =?iso-8859-1?q?APTi/CgpX0SwX+BKXfJleotVOiC6O/awU2F8n//ojSH7X99XIW18XVmgaIQX?= =?iso-8859-1?q?2ElcK7LmSJW1W0pxer6aLPyXgcdcH6/N7Ixr+LLXa31jZKvNaHzYO4jQLQWP?= =?iso-8859-1?q?jBsuTTiCTu3G87h69ujBI3YBF6T1WYz8punmI9p9SnYlGlUq9vbfKTOdlSTY?= =?iso-8859-1?q?KDdwdj4eDF4LqdW5aDDKHCmgVOWwxz3OjgnHZJhQNmDbAenbyUIFhuHK3Rf9?= =?iso-8859-1?q?v6QYJVxOENUH7XeuHtOqrt7kpPRqnTdz3NK+9U4BNthMzQntpXOKfwWPt77k?= =?iso-8859-1?q?wZrL+2Tr+4aGOviUHlc18H35M+e5SQ8F/H6aCb9EfNwZcHS9h60d5lHX9hd6?= =?iso-8859-1?q?LqIteOIOrvZHogL8EtvY2zz1ajnHOR1UwQvQcADgws4R5xgsrymHSBOlSI11?= =?iso-8859-1?q?/1fRSkhFlNule0tnOoow8iV7XtMizO/TTxo3Yfpf/RQMcmisR3vQu6sk9Qxw?= =?iso-8859-1?q?0Uks0fOmtqb3I3aZN3F6xaCq2A+aqD/2O7Ecxg8ZVT+GrKDJbxp/V/WDBYb9?= =?iso-8859-1?q?bPE0AE0sDBZELTs82+ZOfTRbabdEf6D7fkAtOMwIRft3RAiwj/l6Abwvghls?= =?iso-8859-1?q?0c4iyZ2Bs2Oz8epzQtPDbtSdEmzKH/PNEjS/Cv0NgGIUjptLhF4E+0P/VthP?= =?iso-8859-1?q?TW1zOk62HwUUyz4qTS1yAc+n+eZsmYMMUzYKpc5udgdFCt0tNOssw6x9ft6F?= =?iso-8859-1?q?D9h+XZ9PEkFul0t3tbdiS+ZRi+H+ncG7dkxP+JOO2DhQ0A+0HDhKQd5OmLpC?= =?iso-8859-1?q?tPtwb3TNTJY3fM0oi1fzxjds4OTAu+1nGntptvDKkp/mLdWcojUFDfavKH1m?= =?iso-8859-1?q?fPpwqoAruGw1ssEYPM79zu/8IWPm9OH0+YTT6sgiecMuffdq9j6HyrkbqFr5?= =?iso-8859-1?q?UJ6wpRoHrKMscbyjO0F3zWWBOUN2/DFNciyiTjIywMgOXMlZw203zN1ni0Rj?= =?iso-8859-1?q?kIRZRlFbb8pxPYI2ZdRwTgSF410vW9r59wK0lJGReLbl1kcxTTqKaaanteT0?= =?iso-8859-1?q?yVgF//3BVemzGj/+KmnPb5yGTlB+1u0VAsbJ3ttL/R2pDf/MEa5oMXWrb6xk?= =?iso-8859-1?q?OuBI=3D?= MIME-Version: 1.0 X-OriginatorOrg: csgroup.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 0267c4cb-a780-428d-1fc4-08d9c147f3a5 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2021 10:28:22.3690 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9914def7-b676-4fda-8815-5d49fb3b45c8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: reEgNqq1CcknQMMtvcfORQNBZA7fKEm3+PAlFdRVVFlgdk1lumeUtlSvehS2gceHqlaAty5nyP7fhhTBZaNSBMT/4FQv/T+KnxfLi+FDrFQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0146 X-Rspamd-Queue-Id: 2A6FD100010 X-Stat-Signature: sgxdh7u3365fnuays4g3rz4krfge3zdb Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.77 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam02 X-HE-Tag: 1639736903-819283 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: arch_randomize_brk() is only needed for hash on book3s/64, for other platforms the one provided by the default mmap layout is good enough. Move it to hash_utils.c and use randomize_page() like the generic one. And properly opt out the radix case instead of making an assumption on mmu_highuser_ssize. Also change to a 32M range like most other architectures instead of 8M. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/process.c | 41 --------------------------- arch/powerpc/mm/book3s64/hash_utils.c | 19 +++++++++++++ 2 files changed, 19 insertions(+), 41 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 984813a4d5dc..e7f809bdd433 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -34,10 +34,8 @@ #include #include #include -#include #include #include -#include #include #include @@ -2313,42 +2311,3 @@ unsigned long arch_align_stack(unsigned long sp) sp -= get_random_int() & ~PAGE_MASK; return sp & ~0xf; } - -static inline unsigned long brk_rnd(void) -{ - unsigned long rnd = 0; - - /* 8MB for 32bit, 1GB for 64bit */ - if (is_32bit_task()) - rnd = (get_random_long() % (1UL<<(23-PAGE_SHIFT))); - else - rnd = (get_random_long() % (1UL<<(30-PAGE_SHIFT))); - - return rnd << PAGE_SHIFT; -} - -unsigned long arch_randomize_brk(struct mm_struct *mm) -{ - unsigned long base = mm->brk; - unsigned long ret; - -#ifdef CONFIG_PPC_BOOK3S_64 - /* - * If we are using 1TB segments and we are allowed to randomise - * the heap, we can put it above 1TB so it is backed by a 1TB - * segment. Otherwise the heap will be in the bottom 1TB - * which always uses 256MB segments and this may result in a - * performance penalty. - */ - if (!radix_enabled() && !is_32bit_task() && (mmu_highuser_ssize == MMU_SEGSIZE_1T)) - base = max_t(unsigned long, mm->brk, 1UL << SID_SHIFT_1T); -#endif - - ret = PAGE_ALIGN(base + brk_rnd()); - - if (ret < mm->brk) - return mm->brk; - - return ret; -} - diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c index 7ecadf5e6bf9..68a5468b0f19 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include @@ -2171,3 +2173,20 @@ void __init print_system_hash_info(void) if (htab_hash_mask) pr_info("htab_hash_mask = 0x%lx\n", htab_hash_mask); } + +unsigned long arch_randomize_brk(struct mm_struct *mm) +{ + /* + * If we are using 1TB segments and we are allowed to randomise + * the heap, we can put it above 1TB so it is backed by a 1TB + * segment. Otherwise the heap will be in the bottom 1TB + * which always uses 256MB segments and this may result in a + * performance penalty. + */ + if (is_32bit_task()) + return randomize_page(mm->brk, SZ_32M); + else if (!radix_enabled() && mmu_highuser_ssize == MMU_SEGSIZE_1T) + return randomize_page(max_t(unsigned long, mm->brk, SZ_1T), SZ_1G); + else + return randomize_page(mm->brk, SZ_1G); +}