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+5fWDLPXVd8UTBQ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1gdDnmk1adB+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