From patchwork Wed Dec 15 06:45:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12677585 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 CACC1C433EF for ; Wed, 15 Dec 2021 06:51:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3A166B0083; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9966B0085; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D65F26B0087; Wed, 15 Dec 2021 01:45:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id BD2A86B0085 for ; Wed, 15 Dec 2021 01:45:30 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7D7B3180BA54E for ; Wed, 15 Dec 2021 06:45:20 +0000 (UTC) X-FDA: 78919092000.09.7B2A073 Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90052.outbound.protection.outlook.com [40.107.9.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 2FEF3180005 for ; Wed, 15 Dec 2021 06:45:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxhXpEo0KVuhbn/gco8LAuRDr6AxRT/b0RzP/dYMSi45GppTv6izyOctZCcPH4WKSFMzjp8jyHgQpyhFmwUJzdc7f1tVb7MCBIjZ0tI0FiTx6SWwVY0lbN/e0s0ECZv3N32C+ihOOtc9v9YQer1tSLh/1bGRhWbRxr5SEJNvPjWtRn0QaEtO4mphoSQO7pf6Q9660/o/JjV2XYikjp2tsR8XZNRRxPJ37QYEWCEKf5X12VUMzTGIFn2vLB4r7MqgQFue9hoO1dpj8UtADzlK8y5hhP9UDJ9IY7k114x9hdMcTwj+Fe2WW4eJWXcOQIdLbMSNvEfjJnwXk9Mi9G1Qdg== 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=Yfgrin3/elY+QYD9BZJWO5398zlmvBk2smLqz93p2ShmdqUuYXajPn9X7UcZxn89ujQs07VIjZ0+CINGzcXffQsh6nVh7QGe12ozqxaeW+GdfKFLO0VNeZbd+U9G3+yo639JrjQv3bOlq+N/Q/w0w0j4BvU1uioGIsxCDRoJyNFVBFg7kHNZFoiQ0kEn7p7gLN8edtbB1cJS84pXRfhNtPKqDEldDQ2rxqD/2gDnMfHo/Kj02Gn8jONgpArJOyq+58v2aJu+xCYXErEgUZeHlQUGVB4qJq8fdu0ASRknF5MO6oFR1IHcHSScaAwUiiGrowa1dMS4Sr54HRizEAZD/A== 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 MR1P264MB2147.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 06:45:13 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::fc67:d895:7965:663f%2]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 06:45:13 +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 v5 08/11] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Topic: [PATCH v5 08/11] powerpc/mm: Use generic_hugetlb_get_unmapped_area() Thread-Index: AQHX8X9PFl6iCMIDuUSKEdqOR1hcJw== Date: Wed, 15 Dec 2021 06:45:13 +0000 Message-ID: <7e151023284051a14ab088b9ed284efbac0048ef.1639550392.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: ff287c5d-3e08-4498-ae14-08d9bf96724d x-ms-traffictypediagnostic: MR1P264MB2147: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: ycXG95SEtS/UWrhfk0SOHzD/JukAaQ+jaP8zblcg8MtnLyMl6Mm9UIEP5egiuroSDsT0u4FNCDGkt61Kd3nul2wQ/QgwgDjlMZEYixhsVVB3NGru0cPBZxjNsGgb8MxqhM40NTiNHEmPbJq07bdScCh0/xVvl/YGluTxb2DaqpJdibZ0CNUQd+M7oOySKAzBgutIjs2ecBRVH/p+RxNMlAl4thaam4nsCJfUVu1fzf93fABUtXfmBFs4KVpa3C8hX8Bw2RVAD6lXKuysp2pv6UfieE3TItchpRTf3oriyK55H5dY1Yp9oS65idZp61cJk5lW5wHwnqIpBiQNvpxUsxfksJ+3AnabyG/meaeqIBihAJ+w2LCKgjuzw/cUECL8qVJcr6RaEoSt3RCxUD7QnjRw0qzlumajQvHy2uoovF7rEqRWSStzSlbKJ8izoED3f4w9Io49Zl5iaL04Lt4+NKmAhGIATCoE/Hg8Xy+kxatRTFG065qFxWHZTAGeZhIJ/vr8u1IcD9w4TYg5zScGm7zsv3gWuxRIZQBuq8sLnJWpbhJ0dwHfa6sdmEXPl8STOr4El2lIOsAHptYTaqnrqC19mWgAI+zEUGFh6szJs3gVrN/omZDRnqFvd8dCcqGTAD/ljKedCZdJRqV+J1Pw2SqSRQjssPjj70T1G9h7LCDwJIuXlkQk5OsSe1WZfT7Fm5EdaAr62Q33gBSQ7udb5bBmkgEwxkp/I3Ch1cYZarA= 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)(110136005)(36756003)(6486002)(2906002)(86362001)(5660300002)(508600001)(26005)(186003)(38100700002)(8936002)(44832011)(54906003)(316002)(66556008)(66446008)(66476007)(64756008)(6506007)(76116006)(91956017)(8676002)(66946007)(4326008)(2616005)(122000001)(83380400001)(6512007)(71200400001)(38070700005)(7416002)(41533002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?ywyzsHPr5oUQA3yBp06ga4v?= =?iso-8859-1?q?qgsRkulorVfLzvHs29P8R/RTglk/cPJIycP2dJCJd6m21GuR81qQy7gUc6I+?= =?iso-8859-1?q?E0DcwOExHDDSwcKGfEMao1azAIFhj5cuJv+n6LsSKlWlQ0FMfF0LPx30XYBP?= =?iso-8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QbL2lIv+bZZLfIW5xXjX6pMfpiA/TK/puvS6fsDaocx?= =?iso-8859-1?q?2vyy8aaiOpcHe8GwxY4UYfcL+ispuoJmBWwiS1IZ/Pgv83CR+N2qlCRjj+kI?= =?iso-8859-1?q?T7N1fQVIwQMcMAedR0L7Up2ISgXM9H0w572Fwct13j/upCVFMWn90R++Tq3A?= =?iso-8859-1?q?KFcxcRsFnK6MKUzWzhjX3eULE9okosfQ12TdcjcvXin9V+VCpP5Mz82Q7ime?= =?iso-8859-1?q?RukrVTaQ9BJuRPyeY10Aqxc7ahD14tn/lA27i3m+a1WkHCciPeex89ZOdKMp?= =?iso-8859-1?q?+KV2vfcG0ReHJZ83ynsbVFOWw6Iga0ag3MjSwTKKvnJVy2lEiix/lCZlzgLy?= =?iso-8859-1?q?k39j5ZANNN85TPZ0EVwAGkLiVmZ0+2jzpIMAzUV6a+Vv0XAbg3MU+K92rdxa?= =?iso-8859-1?q?3tXZ5Hkb7eAsD4cZXOlE5BWALf7CmX6vJ1cJmbqnDT/4LroYQImxjNm0T1mR?= =?iso-8859-1?q?yqDwGD4FzMEEJ1dysgWztusbmAgQMzgKGO9GeZ2h0JEi0tx5Ay91rhVc/LPZ?= =?iso-8859-1?q?lOOQpEyxRMLidqUGx/IPp7arH7XotNKN+EIbH202q1kxWn3/J625U8OiJa6T?= =?iso-8859-1?q?zV5bmNO/H3LinFOm/aGvGNsWu+NmgtH5HIwFR9S99cYQ1mo8+8t0aenwDJNg?= =?iso-8859-1?q?s7OdaGDksT3n5C24FPPAbZK9B5z1V441vahaWAGs2tFEFrNRubxVTVVDQ8XF?= =?iso-8859-1?q?GWFU=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: ff287c5d-3e08-4498-ae14-08d9bf96724d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 06:45:13.2164 (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: tIZuM52tXLRnTk/v8R/6VENKgzPJvbO89NcG6xD8PqcuY1lEcR7egXq6PWmjh1or0vd+7O34kCq6yUY0aFrgfC5nG8g7idwLtz73lJn6Q2g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2147 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2FEF3180005 X-Stat-Signature: ju6ogguyikunursasafq85o9w4hxquup Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.9.52 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1639550719-407891 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