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