From patchwork Wed Dec 8 17:18:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12664909 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 73CE4C433F5 for ; Wed, 8 Dec 2021 17:19:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 810B56B0074; Wed, 8 Dec 2021 12:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BF826B0075; Wed, 8 Dec 2021 12:18:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6397E6B0078; Wed, 8 Dec 2021 12:18:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 54DE06B0074 for ; Wed, 8 Dec 2021 12:18:33 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1C5B18848B for ; Wed, 8 Dec 2021 17:18:23 +0000 (UTC) X-FDA: 78895285686.08.DCE7FDD Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120048.outbound.protection.outlook.com [40.107.12.48]) by imf04.hostedemail.com (Postfix) with ESMTP id 431C140004 for ; Wed, 8 Dec 2021 17:18:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c5IHaE1RghxPOzLoXLyQ98RvEDd4Gq0828plnRsToIv9/bbhdIjXR8yBjLzb8OqCNx+g49j3E8lVMIHPRHC+DbbzxznBI5IZ0ZbGHSiSXWYUEPKe+xN2y4FGAS390cyOJ/pAvW1pkMvQDalvPxmDL4ei/bE22bewQ2WiU/w8Uw5/wBg1Efm2K/rSjS16H0amCY62i/z33YarWLeNxZfW0THULt7HNH3HWC2hllD/DE2pd7D5SC2mdr5+SoPy49P/o84qHvBTKo4ybMh8NZOuUQz8OUmS2kUYhXmeCzerZjpYFUXir0bbfXdS+ypFqxKa9KWHUYBr2IeZkg32tRnckA== 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=mb8oXjzBpjFNS8rXv0nZ8Dve+gNuL7r2/5q0eP76QFM=; b=Bc/EEAwqihmeEIgc0CkJJpKKija2VGGujsLfFs3HvTruipgmY/KFW9iN/9IoSfHBQzvH+8g8wB5cY8rf5DbfR4BgVGryHWLCIUS54QBrpo5K/S3paUq1VAAYufbZb0tpl4CYtb/uRQRFn+LuomOuVaoHGntSBW2sdFr6GgMdiRislatJICNMk3jCde2KWO3rKZcbEl2bf42yyLSdswpcWe6wuss59cEYN93k2HAr2LOGHHThpyjMxye4ouLAS1m0K4Bk+wZ+stG84KL+qBjEa2uMlo/nLJRWqX5TZoQc0hLP3dCygD/hWvBH2rQwUnt9irZEfUGpQCPv0IAZp9ALlA== 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 MR2P264MB0228.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 8 Dec 2021 17:18:18 +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.4755.022; Wed, 8 Dec 2021 17:18:18 +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" Subject: [PATCH v4 03/10] powerpc/mm: Move vma_mmu_pagesize() Thread-Topic: [PATCH v4 03/10] powerpc/mm: Move vma_mmu_pagesize() Thread-Index: AQHX7FeXKyJMdySKVkCHabepEx7D7w== Date: Wed, 8 Dec 2021 17:18:18 +0000 Message-ID: <372d1488c35dca1c5af04f95d9b8548ea07ea603.1638976229.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: 9968802f-d74c-4047-9c55-08d9ba6eba85 x-ms-traffictypediagnostic: MR2P264MB0228: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: 5u8YKxULaZMGKUy2k+UmwhvBW80NEC+ZsEE8gcg3T/zBjtwp5DOLXIjHQTBm93+/INeiObeclE/nbdTcu2nv/qoOyplRpGOVQgAsGDOvGg70aIUnl+KYicmhjIUxjKEOh44MI8tbaThd6eeTA/MroIr/WdxeoED5ffGz1E+IGK3YHG54idITy0aCCr9ib+7yE+ZL36lPKPK0zCiUPyWjAfa3qSJ3EVjqhOLPnGGbSBh2MjB47wsECwt9RR/SQnpyo1tZS18ebjY014QdgIB+8Xd5aqdFqT0jh9g6IPP7nVJvpMJ8Xay5Ydw6gr0O2CqwEvO6tivY3FrX9MBey9x6XjZsrfQlHFZSk3VDvPYtIHSsGXwTib6MrXmj3iNuvJr59TT+VmgTp/m7uCAAEhPYguomECZn/TZs9f/CW0lVuVp+658Z1CvTQiISnt7ZSwZn6uTzv0TCPEqQU2P7/X0/G4uKOQviAGZVXKu3UkZcqcH/bscsHpUGjOBwwmSoFPDIua7tGYEbHAyFClKqiy4xdi1yPI3OlcNjWgoVhVcLNP+O0UrzuCGYiThs9da1LBkp7fJSryojE4uElJ4FFXOAfkF4MWMbeUjIV2CTzmNIaLB02kgc87sm73VR9uwJ5JpdIJwKb5IH6c2uFcuEDimPcfGRM2sHrli70w2gIQGSbpRJqJFoIcgGmqgn6PFV3COo6QrBDSQX0LmDHGvH9/gNTQ== 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)(2616005)(91956017)(76116006)(66946007)(122000001)(5660300002)(38100700002)(66476007)(44832011)(6512007)(64756008)(66446008)(6486002)(66556008)(8676002)(86362001)(4326008)(8936002)(54906003)(508600001)(36756003)(71200400001)(38070700005)(316002)(83380400001)(26005)(110136005)(6506007)(2906002)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?OCPcTq7iChTlb+wkrhu+ryH?= =?iso-8859-1?q?hDeHduavcUj5hGuux1ihsIzN4poDrcLdJlEWz6F7Lmsqoa5CepJ03HqfvyF/?= =?iso-8859-1?q?PFaYh85bPRG0lQw9BN8NxFXJJ3kG8WSmBEkfikgTGVgN75CSXl8lhLvlIQCA?= =?iso-8859-1?q?o5EnadRJYyZWu4Vm6n3ezrJ4rAfJEkygJi9PA9aX+Svy6zsxSWMgd3mNigOj?= =?iso-8859-1?q?mCJPLjBg+qAIUzULM2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P6rFC7LxZX75ay?= =?iso-8859-1?q?No6Lx1+wN+/nRO1XELYcmIyuTuMtt6fCZ1a4cUVOFBF3dFLAlM6VfrhEXk2w?= =?iso-8859-1?q?sYG5WtxWryVUt/wYq8s4G1VBpchd2W1W1AoKLEujbkYYsh/evgadnTqSoOAS?= =?iso-8859-1?q?bzAW5zkPOaXTwHAvIz5/YACsCv5mgq6TA5i+07v3uP90UCdAVKqkPCwcNg49?= =?iso-8859-1?q?PAwnyLpS1zvLKRfQIVIY6Dib+hbGw1Gpf3dEPN8jAirmA72edR5YsX9cCNAJ?= =?iso-8859-1?q?o7gxPDxTa+yDjxX89nZEons46GwZZbZGOyIS01uiyiy82HFSHrPxQlB5K6uK?= =?iso-8859-1?q?GbHU8R5hPY0cXCoJu59whw4fKFKNqeWKPZg6dWd3zjseUnM8rJ0mKWiFzdc0?= =?iso-8859-1?q?vjV2ajD4pgBs6m+bNLh8Yy3NQGyzofTjcV5xA1mdrH6TdRK1VLghnbaUu8DX?= =?iso-8859-1?q?F1jhYyUE5RO0+6O39u6XxInu+wJbtfQbPDshDn9yIt+yeLQTi2yBwdKJchkZ?= =?iso-8859-1?q?gZdnoqR106QAz7e4rNvIfxSjoZBb+RIYcDjCoOYLnADiaIF6fbbcZl6pMLiR?= =?iso-8859-1?q?drtcejjydlfV2/vtMQAK9vFnC5+jhbt8XprbwpqDo4YqrylIRcdE08JPxXuA?= =?iso-8859-1?q?iA5M=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: 9968802f-d74c-4047-9c55-08d9ba6eba85 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2021 17:18:18.7187 (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: wwaUfq7CZF7oLA2RRRdTKPI09LS7PevKZL6LIz3Ki0Y67CVOQ8Wzw/suNyy9pae0bryooTJMnrPIP3c5QZAB9oGnb5iKBfv6R0MyKmQC72A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR2P264MB0228 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 431C140004 X-Stat-Signature: fdymxstmhxampzczmwu3qqnyt91y15e4 Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.48 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1638983902-729688 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