From patchwork Tue Oct 5 01:31:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 12535329 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE2B3C433F5 for ; Tue, 5 Oct 2021 01:35:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2592B610C8 for ; Tue, 5 Oct 2021 01:35:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2592B610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9539C940035; Mon, 4 Oct 2021 21:32:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 901C594002E; Mon, 4 Oct 2021 21:32:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77C14940035; Mon, 4 Oct 2021 21:32:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 67FCF94002E for ; Mon, 4 Oct 2021 21:32:00 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 331722BA6C for ; Tue, 5 Oct 2021 01:32:00 +0000 (UTC) X-FDA: 78660657600.24.B1386A6 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf20.hostedemail.com (Postfix) with ESMTP id A1126D0028A0 for ; Tue, 5 Oct 2021 01:31:59 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19508Mdl004481; Tue, 5 Oct 2021 01:31:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=taad8FPo9G2wWA09nDe7GP761yIwtzMi1D3jdQKhS5o=; b=VdiAbNXEBWkMsC/VhJqFuxo6CRn4dnqAZcn9l+j9ZVq3tDI9JMIZzZS6L/oW/xJYcxSg Yf4mIqZTv03cJfgq9I8xTYGZ3R+XjyMwRAaZQPoAg672SIBxbMCEbEdTn4mb34ijIQdv 4ftfbC24KazD10KjeEQc3rL1Uu53M3k946Xl1FHcoYUw8uh70CbQQuqr4odbhxHEDY0O hBAponVWd1CVZpSBURbGSr9FjdRUEy0nkUkkqZkMbCiM40a71bJAZCtWmZiq+QI2cE4x SR8fRtdhRW02l95jLVZSzimWMFSJjdagHTfjdGtwGcW2z7h2EqGwqzND2X5SIBtEt6+8 EQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3bg43dumqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Oct 2021 01:31:34 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1951UHTV178361; Tue, 5 Oct 2021 01:31:33 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2171.outbound.protection.outlook.com [104.47.58.171]) by aserp3020.oracle.com with ESMTP id 3bev8w0386-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Oct 2021 01:31:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ltqpbm4J16Cd3NNkTGOBFywbfY/So2I9IxVtKRvlXkvhkqjQe6MQtYKcPB6BMhelTyUNOZ78VMjFdk4srOcQKhbqv/6PJ2WjFk9mTzxkftjkC6z7JBlW+AWCa7Wddv8qG6Q4Eb3T+FzncQfRwHGyrsEuT4rk42hFnGwI60wH4i337r3i1q+gZAhPSGp+Cm+D6KLcv5uOqChTrp8baMeJLC1RYWBZj0kW8eH5Ffd/oqbRXKWf0wY/rCFtXXY95NPufXx36vlAzg0vzw1PM/AE4HEQkfzbmwPH3NjmdFoQVe8ZpPZ3jxbgQYnO9xm8Pr4/muiLzJUZviAsaZ7g50yFUQ== 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=taad8FPo9G2wWA09nDe7GP761yIwtzMi1D3jdQKhS5o=; b=AQhxOXf2Y9gK+nD7nAKn4UQ46lIRaJwufjQ4kxqJTtHsp2F7iwaqxiHO1ZZEAAD37INK8xSU+O75xX1+ho8waFdRIZm2am+6NR7I/bP8fhY3zQPS+ZqsBAoBGNOObiIXFfvaZpa3HmaFpFc6HKtSCoXtQuZS80LE8XbwAcycfUxi9P9K2IlG38uSwp80FOhoHQx+f0LaU3rFS9rBrghxWTZS06Cc66JiWCvSdLoYBaLqFu1oMJdP49cUt0lmyih5EvDE3XWDrxcXEPHOqRv6uvlgr23BEl2EkA8cwACmn+HmDXggAeO3T4wUBRoMcMEE1BPKNKrBWEijRgE5aSuFhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=taad8FPo9G2wWA09nDe7GP761yIwtzMi1D3jdQKhS5o=; b=JRm9HpuJvB9gMIMRUdcbEuSz/gPQsfCGPbfkZyvpBUfGsr1t+1pLUlRnYTfBA9806D5XOCHFZOy/TEQ9rBw1hjbpEp/Z0J6fJND1zvEqgnmf61PZEab5S3I+fBVhs+BeLQiI58fP/ITfSIDN7jQgVnsLktZ4eNcrCpJpMJh1Wlc= Received: from BL0PR10MB3011.namprd10.prod.outlook.com (2603:10b6:208:7e::29) by BLAPR10MB5044.namprd10.prod.outlook.com (2603:10b6:208:326::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Tue, 5 Oct 2021 01:31:26 +0000 Received: from BL0PR10MB3011.namprd10.prod.outlook.com ([fe80::6d61:54c2:40f0:93a]) by BL0PR10MB3011.namprd10.prod.outlook.com ([fe80::6d61:54c2:40f0:93a%5]) with mapi id 15.20.4566.017; Tue, 5 Oct 2021 01:31:26 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , David Hildenbrand , Douglas Gilbert CC: Song Liu , Davidlohr Bueso , "Paul E . McKenney" , Matthew Wilcox , David Rientjes , Axel Rasmussen , Suren Baghdasaryan , Vlastimil Babka , Rik van Riel , Peter Zijlstra Subject: [PATCH v3 56/66] mm/mremap: Use vma_next() instead of vma linked list Thread-Topic: [PATCH v3 56/66] mm/mremap: Use vma_next() instead of vma linked list Thread-Index: AQHXuYirHzkEEnfXBEmxcW6HjmUcXg== Date: Tue, 5 Oct 2021 01:31:07 +0000 Message-ID: <20211005012959.1110504-57-Liam.Howlett@oracle.com> References: <20211005012959.1110504-1-Liam.Howlett@oracle.com> In-Reply-To: <20211005012959.1110504-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.30.2 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e2a75ee5-7886-4215-9524-08d9879fd932 x-ms-traffictypediagnostic: BLAPR10MB5044: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:431; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1nfMcS6+gj/cX4K72VVcvWSCvCNvxm7mcVSCwihpDkQiRV9/nLeMoJCYud2YVrXzwCE5HlOlxMue6OmBCwL+kOy34QCgW6RrhSVl2fIzyhaSh/Tbr+EbxBpPJF1f2rUQwYdPWN1jzGJy+rS944Wfsr3wscFVLNC8F4/yY+klBwk4IvHSVM95JUNQw6U6sAwHIX8kpMc7FCq0LDNUuSLrVX+I2b5jCRGPwfDJo7mBR6jq2kFI0rEjkWtd8shSzOa4R6rOagW4FSWVtU03KlVOl/HRZt0ng4d1glBA32yF9qOi7kbgRH8hilUnPVwhTvt9+1Ix/ZDDEkGvu7a0LOvi+YvudAcZ3BQlR2wzBbAXSedxF+mnIVjb7mglfYrFx0CCZQ83jmrXfMP6XiTcYsR128Yp6Y2PzszLyotnllFJhryI2vkkfr0I1ytsG6R+2T39WGbZOf8dzqPk8nHYZ9LOpAoBXZ9frFRvOeGRCzgfPKfWYzDxUS5P10C1G/i72LtumhcpIg52AJc5oMBWrWQBnCJswMK00YJT46nExV56fDzPDNQ9VNM719DurkZo/uXB5kc2+Vw9EiolvgRlY4DIJ62KzOyqx0LxNiS7rfPWOrpFw590N/SZou4dU6HRhVWiydDgbruorFvZyWMGsFNlxWg0fYhcieoSvXHBrvMb1mkj0NqpcNY2mWxk/tsIvvVmrEv3lqal/G4eSf6YpG2XJg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR10MB3011.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(110136005)(71200400001)(8676002)(86362001)(6666004)(6506007)(6512007)(36756003)(316002)(8936002)(54906003)(2906002)(83380400001)(186003)(66446008)(122000001)(26005)(7416002)(6486002)(4326008)(508600001)(2616005)(66476007)(44832011)(38070700005)(76116006)(5660300002)(91956017)(64756008)(66556008)(66946007)(1076003)(38100700002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?H5gEwKoMMjniA91qkgw2l3L?= =?iso-8859-1?q?1UIshDwXi1RQG5FkZoDhJ0YINQO/DN+XkzcHdlRMjAnJUQPIhJCpGE3MjEFX?= =?iso-8859-1?q?RY29v6e3fwiaICDJGK6Y39O3PG3uJJxMYT5f0rcsP40PaadWIDADsxBBzdV5?= =?iso-8859-1?q?2mhC2pBUdrMVgaPFXjpvtBihrXrxBWhtKnuCTZSjlD/rZXjsRFVIZqHquSfd?= =?iso-8859-1?q?NJOhsXXXyYIX+BTRei0gx8CwmTcGJtaHMILyAdIIWRc5w+lwjSI5PTBVOhOd?= =?iso-8859-1?q?ZIweDFfaOpmnmglXCiAYbnNz+GxE/SdN+kKgp1ldPND9a620Efvmld2jVOmW?= =?iso-8859-1?q?NYIVh4KyJNZFh64QP2+ah/0zlBkwKS4cEMsw9g8GJHg0+8lWIejcJebE8nHi?= =?iso-8859-1?q?RseES1NiYtfX0d3xD3J2QJiauD4g4xCmcC3LAl9EQM5OLzfJCQtO4mOGoTqf?= =?iso-8859-1?q?xCYBqwKvzdZAQ5USZ4kGHB9zgMtwIq+xIKtRWQBAwiCxZJIndTUGD0dg30gE?= =?iso-8859-1?q?aR6mvwpS3CnPFNXF5jcw8Sn4+TmovgKqvMhhWI/tjgXyO1U/HGldQBfM2Ryw?= =?iso-8859-1?q?+tsIkypJXPCnKHS5/qRCCMVQNudUJic+t4agf91CZjPFJG7f++2q4EZLDkJn?= =?iso-8859-1?q?WeA6ATF8VzibBVlF+lv12Dx1+idm7Y9WWbmVhFnJsukG69CLQZqWnrrvWSfs?= =?iso-8859-1?q?LphFUIjOCLhWe2sLLhUy5JHODp1lYUL31bb7LHQ4cQcK1PMLhGTdQgTTJ432?= =?iso-8859-1?q?ZH6kqH2KhkZvvLvPJxhk4kqnLVfbnuhb14xeMf43qO5zc0kQ4hAT3pIzkSD3?= =?iso-8859-1?q?XnwIUulnamLXjGogDifq+BmrO+bf4GGAlIqvIY+DKZ+gZfggB0qDvufQrAp3?= =?iso-8859-1?q?+Jl0koVu3NAq6aFf1XA95HpjCo/TqDGj1JieA4E1OEaMsgjsVv54vkSCPUKg?= =?iso-8859-1?q?9Kh4l355/AwCMVGwZNdP4c4ySLXZssyg+oLlqM/U3VDEbonRCmlQSjJZxnT0?= =?iso-8859-1?q?hb7+Wsd/GPZFaUp5qy1lAgbP504r1bZ2rIUDfJCKakIODoAMnaeE+mbi2i3S?= =?iso-8859-1?q?HmpVleWWh+4LzJsC8uw1MwNwXTeq0+aWK2Ij/J+Q6dFoj4QEP//wCCjRgiAj?= =?iso-8859-1?q?dP8y+P4ie9zMja4MlYee8vZehm62mrEHoHg10yfa2fNR2NA7bB2WdTPFUfJt?= =?iso-8859-1?q?6GU0VCkVZAlXUrkD+LZO6Q8KxCC6YRlIJpSq/tRonHdiENz4oF01b870PA+M?= =?iso-8859-1?q?vWov8VE3yqO30mkHHsvTqe1nfwgOd5celahbNeu2l+vm09D2VPqj9+1foMsO?= =?iso-8859-1?q?SXGI6Webc6zyJKjb2tEB1XGi+V8n1wY6lGgNzidD/Iq+q/v2rrhhROh6TTvu?= =?iso-8859-1?q?P?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL0PR10MB3011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2a75ee5-7886-4215-9524-08d9879fd932 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2021 01:31:07.7072 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hhPXCkK1eNIQo3ynPUoS1wWxOO+Fos0bilPZ0x6JYzifGvkGlAfFn2Q4rusAMB2Lwt2b3qgC6T09SgTuLBjWXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5044 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10127 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110050007 X-Proofpoint-GUID: Eb954hjrV-coh7NeiumRsqAqt7BCmztK X-Proofpoint-ORIG-GUID: Eb954hjrV-coh7NeiumRsqAqt7BCmztK X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A1126D0028A0 X-Stat-Signature: qgbccz3bwq86xyz74wprrquoc8c3pztr Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=VdiAbNXE; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=JRm9HpuJ; spf=none (imf20.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-HE-Tag: 1633397519-559480 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: From: "Liam R. Howlett" Signed-off-by: Liam R. Howlett --- mm/mremap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index 160ec0d05465..bcfdabab4ab9 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -701,7 +701,7 @@ static unsigned long move_vma(struct vm_area_struct *vma, if (excess) { vma->vm_flags |= VM_ACCOUNT; if (split) - vma->vm_next->vm_flags |= VM_ACCOUNT; + vma_next(mm, vma)->vm_flags |= VM_ACCOUNT; } return new_addr; @@ -875,9 +875,11 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len, static int vma_expandable(struct vm_area_struct *vma, unsigned long delta) { unsigned long end = vma->vm_end + delta; + struct vm_area_struct *next; if (end < vma->vm_end) /* overflow */ return 0; - if (vma->vm_next && vma->vm_next->vm_start < end) /* intersection */ + next = vma_next(vma->vm_mm, vma); + if (next && next->vm_start < end) /* intersection */ return 0; if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start, 0, MAP_FIXED) & ~PAGE_MASK)