From patchwork Fri Jan 21 08:42:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12719499 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 18A36C433F5 for ; Fri, 21 Jan 2022 08:42:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C8996B0085; Fri, 21 Jan 2022 03:42:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 778A76B0087; Fri, 21 Jan 2022 03:42:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 619AE6B0088; Fri, 21 Jan 2022 03:42:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 5396F6B0085 for ; Fri, 21 Jan 2022 03:42:19 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 112258249980 for ; Fri, 21 Jan 2022 08:42:19 +0000 (UTC) X-FDA: 79053652398.14.5D13734 Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120089.outbound.protection.outlook.com [40.107.12.89]) by imf05.hostedemail.com (Postfix) with ESMTP id 3599010000A for ; Fri, 21 Jan 2022 08:42:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1vS1iAAsesO8whdpnWr+llG5zc1fx76E1TN3tJtqJK+fMpX9dh7D0IQTlkmYIUO9ql3CHB+1GtGx8bYGUqjU57MbJ+lRqPu+KNmxrdJq4osXB+iNkwk3rIk5+P9uPh+7aOqul9my2K1nKN2J7jkqj+TzvOvRMbkUrmlEsstB0nklKxQgTDuCTzIbmTrfrO8NBSgH0VPxsIcZQFXv2TldJnC2LTrQ2bojKCniK7grX7SE/DeOA5IGzhJ8u2OCgfPlrWzd6INXW3r9/6qoAldlTt1VgOnK4EOCmHVds1bMU2qRz15Pf0Qcf6IbByDbH1WjrY107k2qi/hV1tHhVELQw== 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=qiY1jWq5N+mnYEomtogvvA2McR4bD1uoV3qJr5FQods=; b=GcymXMlDT2qxp1Ob4jLzSTazGw1md/xULL/2iHk2+PRUoJwp19NNHzvVwSxQ280QO5iDjdMMdho9OY71J9vNWZZuXrVc4kEkuzl21i7WRfdWs9cK/sSz43Pm3enVEbt2YDGHIH91FUR/Tl4WnfqIjKdGC+6Xvy+qGZEiYQN3fgbpT1Lr8xHq4bkyGzqqDIQ37yOgvA3EC7T/l9ci0nYXME4GTbnpn8A9EbzE6+TDN1gQg2kTZQ/UgfvhXdBhCZLjTAoJ9T1+pG0PsNjbEMEwuT2ROCz634hsP+OeGtrTM4bPx1/IR+mdSHhHzzbvPSCjJw8KPx9rxTsyaX4dSjGTRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:31::15) by PR0P264MB0201.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Fri, 21 Jan 2022 08:42:15 +0000 Received: from MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::9d4f:1090:9b36:3fc5]) by MRZP264MB2988.FRAP264.PROD.OUTLOOK.COM ([fe80::9d4f:1090:9b36:3fc5%5]) with mapi id 15.20.4909.008; Fri, 21 Jan 2022 08:42:15 +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 v7 03/14] mm: Add len and flags parameters to arch_get_mmap_end() Thread-Topic: [PATCH v7 03/14] mm: Add len and flags parameters to arch_get_mmap_end() Thread-Index: AQHYDqLK5heG4KdaLUGB33l4dVbmMA== Date: Fri, 21 Jan 2022 08:42:15 +0000 Message-ID: <0c8611ef3bcd758c4ff281b92015f447ab7f9b19.1642752946.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: aff836e6-38c1-4786-5340-08d9dcb9ed5f x-ms-traffictypediagnostic: PR0P264MB0201: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: NayZfWn4N+X3Jc6lG+r+A2cS9vVPR7GFXSRlIRtnFG7AtD8iZ/Ung//abiRrlBGUTIc/QcKwX04QXPevJ3LHAFNxCOUYCehLlFTyaGMl8Iv8sKH8ixnz0t7mUMPlNbVATMAUbAop7ISeVecEFLfW6vUPrCtMZOAZImJGORL5hp/gLLeLW3P9CQXGIDHFM7pkl6FiL/P2sVBUXl6rpylryPKDKtPYhBi0Crs6E+LK8kA7AxS987R8qV2cR6FNwNm0ytCU3CR9mwibcOj2MhCUYflHnxKiFo5+/rg8bDW3WWZvYs7lOqllcL0JiKaKa3Ux8k0UbKl9l+EMYUUFdj+8DY+0bd3xeTChZFAZM5diCfgMwKXWNPP4UmV7Bq3nDrT7fV2jauoMskqRb9fjUpceIVtBqR7Pqogxx7YRtp/7ydPGTRO+BIQMZZj8z1L8D7F705ArGjtdtt8cvym0puT2ZqfOVw0BaIizQxi2o5/hzslzzY78X0A2v4JgvLu5YmdjXHs/xF1sc02WBerGUZzbuwkyAkO/nE3FdJ+IWWRx/XswyI/u0xmnRsfu0hioB0b5hQibeYJoGKJaOvF6t6q1vOUzbbStZOZ3uOGT21I8UABQwK0cYlExgXd2DllQbWtlP7kQUDIlyHUKYLvzceGIj4OIPg8OhwNY3L/seXEQqJf1J6bpsq53NUNLgSfVqlmzFHQZN17Nm96g5WJ0QLhzvw== 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)(76116006)(91956017)(36756003)(66476007)(2906002)(5660300002)(66946007)(8676002)(6512007)(122000001)(71200400001)(8936002)(83380400001)(66446008)(64756008)(4326008)(66556008)(86362001)(26005)(508600001)(6486002)(54906003)(2616005)(44832011)(38070700005)(6506007)(186003)(38100700002)(7416002)(110136005)(316002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?eY+tubdID9Xcakpow3klka+?= =?iso-8859-1?q?E1X4Mg0zUG6cJHGUOniWEbAWTYge4xJVkpNV5cGHJpnA0TseSgm62MMRYo3h?= =?iso-8859-1?q?OIAP7uGCft4Y8ic27ll3HKAewSiM1c/Num5fa9usvW+DIZIExrq0kiIv641T?= =?iso-8859-1?q?xkFdeT/uyjnH8NrvI3Ja8T+V/PcZndl16sUOwdz9KYopR+MVleo+hXQ3sar6?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AXT7Ler4wONfzlS2p+COnoWKncf8diahsP0e7bVyNDumSjLJKaZZIwaF?= =?iso-8859-1?q?/7uZRVrrBQwAtXqOLknzrVl8/1fi2jQVBTJAerimoEtAdOMycC9rxLtFfD9k?= =?iso-8859-1?q?zHKpYy9lUCUNPMQnLsDDEzfiZ6CgyBQ5v13Vf6beLMBjBCnLI6fM4ZH1fyD6?= =?iso-8859-1?q?bWsZJ7W/zC/Dkm5Xzzecs0ClL/B2KRjCUcWaqipJ89QJ5jyDla3WAZDUu43W?= =?iso-8859-1?q?mfrV6MNizAUkmhKt//GhQt6DjtoguJT4jPzeNso+BFj8/uS6E+WNQ9BQar0B?= =?iso-8859-1?q?GziUcR1Z7EC36Uky0c+jE6UCX/KdVt5ptgttqZZF2u0Cii0m8ObMTKbT4hsH?= =?iso-8859-1?q?XZ2NrDMLqBSfAUvvhSprefB4xu3z8WDRzfOT1wg+D+yZwhpcAN+91xU8g+fl?= =?iso-8859-1?q?cyuq+IpIZ7FFb6Oawz0iyMniE6Fi9mrrs6kXsKkxgOgC20J419lR80+hkQVU?= =?iso-8859-1?q?cl4pyUlG3GVZ02+YTWTGcP8pZURpZKP+R0ifj4J5o6MYDYNHRUvWh/abiOsw?= =?iso-8859-1?q?TlGa+UlRoQuDev8h1ad63FJT1s3Pp8qvGjI21lofemeI5UhNLpOq41G+26E5?= =?iso-8859-1?q?Cgwy+WLSeFchmqIsABxoBZNK7b2UcgeGqc02EOK+9wkE9ti0Pzz8Fp1foH81?= =?iso-8859-1?q?P5sk=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: aff836e6-38c1-4786-5340-08d9dcb9ed5f X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2022 08:42:15.8831 (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: 4Y9N0OkziZuTanFLWza800cxWCttcULPNkKkdzY3e6G33xM0NiCsAbRN7Z3d9jE309uneAtt+AC+j8zKMIu5jXHthixsapGU+svz0UZXuLA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB0201 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 3599010000A X-Stat-Signature: 45zt5fi1im5cxnfgerba48d7xzaxbhqm Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 40.107.12.89 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1642754538-146679 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: 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..9ceec2bf4b93 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)