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: 12696611 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F6B3C433F5 for ; Fri, 17 Dec 2021 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i3ykmFIbWDE6ZiJVirJQ1+ZLX/uTH9sYqvvoUu2U8Z0=; b=jHNbyNV3jwgXA4 ITh0dj6dOKIlYTXWb3//q+FhZBbisv5Zn7/+I0I2hWADSC++iIfVS7XhaNDGMwr6DtnvBzSdetukK LmrCFOL5yJ1ebtk3GvlyvITfrx7TZZeJUJCcJ6+6FVbLkUyUKVz5loeFH7Oo9JJzWtHSeUvzk20gk qpiB2I3eEAudrGJ4mD6pl/gK6gX2r1TSCtKlZI2R1J8gs7taTarohNGj1ElXd/IAdRr2tXS2xZAS6 KP/YyNUEzrcHXIkXoMK/al9sVe9B7I6fM+fbBfmXoU6WGy9bimgg7UTaEhmVhxaGWq1lXjD6A7Tjc 5muS1L3LoOFm729vPZgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myAT1-009UNs-H4; Fri, 17 Dec 2021 10:27:59 +0000 Received: from mail-pr2fra01on0600.outbound.protection.outlook.com ([2a01:111:f400:7e18::600] helo=FRA01-PR2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myASS-009UBM-Rs for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 10:27:26 +0000 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: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=csgroup.eu; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_022724_934454_66B4DFF5 X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)