Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5057536imw; Tue, 19 Jul 2022 20:05:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tmQUJ51LIFClEZm9F4cZWCdZKTkBGoRAAwQ62BNJvqQv8F6PocEYPIp7CZH+oMxHhV6b7Z X-Received: by 2002:a05:6808:1586:b0:339:e17a:407b with SMTP id t6-20020a056808158600b00339e17a407bmr1325969oiw.12.1658286329376; Tue, 19 Jul 2022 20:05:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658286329; cv=pass; d=google.com; s=arc-20160816; b=f8hkKWlman0MNvhmie6Bu6XIrCL7eGsnb/zMOIcACLQYNv2uV7h+Ll6vGzeBa4es15 IVJgPrUtOiR0Yt8cvmWKZQEBjTDvkzI8WIbeN5R01PXn9x46srTzICBCgYEJ9XAFXr+3 TfaymNt/PcX5Nphbu+oMOV2o8N6t4AybX9TRg1UKj+DqqJ9BEEnV/bBfi9gv0fFHDFla HFmkUbYZGt3HVXnLleRc9n3pgyU5FbsohJ/t0cHAdoB/jp5JJiRPmknbQMuZxfV1t0ul wmBk4vIIrLnjnXzRrv1D5EKLRIrxsrqikpemtAHKEHgMrp0wahgLitfiSboRLCAZjM1J ZRxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=Nr0GO3LN8h+QW5Z9FMDPCnW9L/41UBlRuV63erX52QY=; b=IwBFl7DvUataWWO3ienAlhGVFxkG/8iEgSW9ZKRQeDjXpUSR+fg7w/ugLVOWEBAfdN 988Wq8ffgwvlIkeMOlfgDLxV3ED1yyF+xfXTApwhwK5SJYIbviKrCyQlFGJYO38R6FSQ B+bxBkdg+zRLE2XqTxCqaB/WohSEtOiwzUYLwIt27e/5rqiTnFcZ4T/97o9Biq9w5knd HfeANStqT/B3ku9WN+iwTsPZcno8ffH3l/3b3UGfQHSQk6Er7kHHrKkiw1WQO/mXIA32 18Q6E4dVWTPYjXPbJ4vck5wt0iJIIZxzvpQV9W3igUhYSEiPicvhzCA9r2M7E1rXv6qR mU1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Ijkxjnr3; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=nuO4clhR; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020a056870e98200b000fe3edccd2bsi15882594oao.148.2022.07.19.20.05.16; Tue, 19 Jul 2022 20:05:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Ijkxjnr3; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=nuO4clhR; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241381AbiGTCWS (ORCPT + 99 others); Tue, 19 Jul 2022 22:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241142AbiGTCVL (ORCPT ); Tue, 19 Jul 2022 22:21:11 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFE2E6C13C for ; Tue, 19 Jul 2022 19:18:41 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26K1U66X002381; Wed, 20 Jul 2022 02:18:35 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-2022-7-12; bh=Nr0GO3LN8h+QW5Z9FMDPCnW9L/41UBlRuV63erX52QY=; b=Ijkxjnr327AhrA+r/SQm9buQDNWuw/SBIgQXxFT90tK5nUJEyM/af2wH1LDnfL9VxVfQ Pqhhl4by2CMDyvwA/X1RUnFJZNqIXODb0un/hqn2v5PI5gtN7wFo3VPl4h1fCeCVHjHY tIEkNBCl5WIIHt8z+bxzv5HuDAqkcJzzUegh81SECIeqYmOoPC7DncQKqVzA2Vp9u9g9 pP/rIjSYERFEtpgUyeI6906p6r7K3DgJtrPReRsg/LjHxTjKxVpMkBcXXzjfz1IeTFhC ndPPKbLJ/FEzlINkY7DiVxIQpzbfenz08pOjJOJsN+07kdfkSEKrnU3BECye9rmj3gco Ug== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hbn7a81n6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jul 2022 02:18:35 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 26K1UAli002689; Wed, 20 Jul 2022 02:18:33 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hc1mbnuv5-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jul 2022 02:18:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DxTPfWVnWqDJ8OHhL9PN/wF6ydeKl0D8ceAjG6gMbBXkHzuNnGIK8XodbSkBXfz7xgkdlRsnNL+eyQaOYabS5z4uJlc70CBVhmup73/yXpAbOVwMGJfoLMB0U0YlqASMzUKc1WpdyaDMqPOjk6Mrlokogxw6/va3MSSINyX6Hsm6NIHBCm580NlBGRkL2UpbsWF1+aUVMsngen+6N9WQJ18YFXRz6PxWjFqvn21YboiACrApqR26G018o9i3BVuzJ9Zxdv/UmxwwhRdYMnSHEwB2h6IR7CJOa9C+uFX9Ykww5cFg4ImbT/um9jKi6QyI5CYAjSPwUvf9PYPN6LaunA== 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=Nr0GO3LN8h+QW5Z9FMDPCnW9L/41UBlRuV63erX52QY=; b=kDTmovHHvWux1XDtBXxmJcUE3jaJKB5MHDKEevaiDql2P9AA2qBS/TTEH6gHwqf6ifBeJm5ypuP9Olsa6SKg2e3YF5Qzu+yqx2jKcGO4Z/ITi7wFoQ3oDgcmjzlDuE/y8QVLzJ+dgevsC3njvVO+zq0k2h1Hd7+POboBv1C5N5S7nuT98Jv6+2rfSu4XMMK1sxHRdcwU5naFtgre9qGufwRTf49VwIjp3DqvidY9BGZ7D87Xp4Cjl5gDXxNWM/jwWpFUSm8ZR9U//75Q3lEJaU+/DfNf2iuIfoov2FyoeZLIvYIgTad6VBnQKksEYb4EJ18bRl4enr6LU1Sy+dF2sg== 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=Nr0GO3LN8h+QW5Z9FMDPCnW9L/41UBlRuV63erX52QY=; b=nuO4clhRoGRJ78+HSo1C91phDZ3QSHKqzCuhwIHLX+h/MmZ8WBAVaS+Rabt+vaE7wmBdg3haqSTpIQJ2RWizgly8nJ7TzFNqtProN9WJf45DHUcJEMBaZ/A93esM0TgDyp8msESZZASGfPwwTY727uT8VRw7+52qfNv7pTuyRAI= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by PH8PR10MB6316.namprd10.prod.outlook.com (2603:10b6:510:1cf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.22; Wed, 20 Jul 2022 02:18:32 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c4d1:edc3:7d21:7c68]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c4d1:edc3:7d21:7c68%6]) with mapi id 15.20.5438.024; Wed, 20 Jul 2022 02:18:32 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , Hugh Dickins CC: Yu Zhao Subject: [PATCH v12 37/69] cxl: remove vma linked list walk Thread-Topic: [PATCH v12 37/69] cxl: remove vma linked list walk Thread-Index: AQHYm97s2fSP1nUcV0mMnX3k1nZFOg== Date: Wed, 20 Jul 2022 02:17:56 +0000 Message-ID: <20220720021727.17018-38-Liam.Howlett@oracle.com> References: <20220720021727.17018-1-Liam.Howlett@oracle.com> In-Reply-To: <20220720021727.17018-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.35.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e97c6e99-e952-468c-aed4-08da69f6249a x-ms-traffictypediagnostic: PH8PR10MB6316:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: c6NqlHfjIDO85FXKBsdFN5y44AQ5c18idhD1s0xQp/KkBlhl5SV6150TE/8Vd7jExQ/LDqLfzQc99BYVSOUb3/6jtIFRiEJzh2Fx37kBUeVBj65v2W0bMcDyXz8qhGDpx51OnuzsmNEJnrH/tjX1hOUKnt/v7HIwbzuP+a+iDTBvZhUdpp79fLaPabRno0EPtsqwqemQ1CK18ePY7I8DYdRWF/WpYqcqep/ib/58ZsDpOI+lfWzmIF8nXXmxcYK9UR7SDpB/FRAu+8bNkaxDet0Au19nXy0UHE/Xrs7/z6O7V1Em5gepRuqK24k3j6Jdd3xwp/8APHDuErhdHHPMkoSI2gTviLg1gyuXzbuFC+KXGwggbADIuI65yIAmtnCEKpiKsvnyPQXLrgUZLTwhKcDIGvDdJr34e/6BQPMFb6y/HUzteG6ivtSWo3UCjDE2PYajbV8DooDzjKDytwmqVNP7mUMW78iVsPWmXK1Vu1kLb33g4hKlzonQL0jQcduKCOaEhJazxPfxP2+mQ2cy9NtT8SiEAXG7yK4fX7IjMdWR6P5Pt4qHo4pGtoeau72q7AaQ/0L0wLNxL/dyFGZtr6+vVi17klrCPu/wpyqEnBFydOvgoV5jrHyqT9upuyj3K9r7FIatFiygkgBQ/CKSa+Y7aCXLh/bXespzlSsDmbXjnqZdkzBvK7MhFIUlO4crh0P46oJkuKPPu5Hq/zevkx5aHW0crFkHODlkyDNQL4AA/92JamDbE6CVGCPaYsh1Jd2ZID30UcZ4lhslxS3AM9OdeFUcjUHvwffvDTQd7/2SM/mY3YjFwTxlV4W72Uf/ZXvnLRTWqOdWJbZtE+REg5Xk93o1I5smqKrG06t/0uzvUw4Fd5tXpBr/IIzekR3G x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(396003)(39860400002)(366004)(376002)(136003)(76116006)(122000001)(44832011)(8936002)(5660300002)(186003)(1076003)(83380400001)(2616005)(4326008)(66446008)(64756008)(36756003)(66946007)(2906002)(8676002)(91956017)(66556008)(316002)(26005)(41300700001)(966005)(66476007)(86362001)(38070700005)(478600001)(6506007)(6486002)(6666004)(71200400001)(110136005)(38100700002)(6512007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?A1Fz+fZcigyVwO3S92K7z9aryU6YLqd5/p1xwe49ttYIrD1C8GmotbF0po?= =?iso-8859-1?Q?hALiShwXwUDJydltpJS+HNX+yvgaC7XI542YntYzS5rvSUMDYXRC4IGqmE?= =?iso-8859-1?Q?vgUrfbvibMyyzAQmh+vTlo+GLDd2YTfgg2ZGK7GsUwKqvcGRRIhhKY3u6B?= =?iso-8859-1?Q?W5Gopml6Ke8Ag0wlSK/0YlFts0GOOih4y9e29KOyedEAyIngHU55NkjaXM?= =?iso-8859-1?Q?uV7hVgT2fwUypEd0KxzRaczeR8IBPmNC2UaxrdeSHp3lo9GcRyd9V62knV?= =?iso-8859-1?Q?VWMSAOFpjqMr/Pno0vNAphtynrbp8d/bB1XEFXgB8jSkiND26pQB3sBzcW?= =?iso-8859-1?Q?IHqE9PPLSIuc6rj8KUs3jaEF7jxMfvhliB4U9Izzk6G1yrwTpLcSTUSg7H?= =?iso-8859-1?Q?AdzibNQpt/d7AAy1wv6hOH4AjYFg9VRw/NbrEugOZ+t9eJuqN9cZQnW/5U?= =?iso-8859-1?Q?6SdqAmVzAXl+3VopQHmrLwv0adAd7J/GLv8FqCb5DgTOe7ShN2vgL1QljN?= =?iso-8859-1?Q?27bqUdN2nA6iQlAkX4a2fw9dt3kDUk7JGDYlrRxZsXtmrdlh/bsiuR/zt7?= =?iso-8859-1?Q?SXMDkI9/ewaq12zB8MloJ0UHGS0wCAieQB+x5jrk84fvSIdnxTh1htelRo?= =?iso-8859-1?Q?/pouQqegqBA5VB/jxKkG4FhBWgqzlMTg4UF49fcrObdnoGUy7QunhYlD6U?= =?iso-8859-1?Q?hcyqVZzUfmPq5aqBAMq6NO4hcUo0nVCmlurvIQfT4xMQd3V4HZgTz/IYT1?= =?iso-8859-1?Q?Mp7gKxPq4zuoPqHF+XE+OqLx8IvFTezTy5CHxyHv/gGtULPVPa/sz9cn6z?= =?iso-8859-1?Q?ZmPiTfhAWCeUA8hfbVO7B8vdbaWMlZQkEWYN002VTrun6JeavZyqxxX3Dz?= =?iso-8859-1?Q?2oKik39T8nUegia4xAUzDokmwiuvgKSg+Lm3OLucOXnFyPMGlbnx8v1gz6?= =?iso-8859-1?Q?SNz54KVPxfH74UMQDfKbVzoQ7Xz26OKbHO42GsGPaY/bGGkKTn8hkAO/ib?= =?iso-8859-1?Q?u6e454eXHuh9/a87fGy/ZRtnfqaehzAHDVj4DeGyQwYS0GlxUaU7Svk3kU?= =?iso-8859-1?Q?vkCTWbigL9KNVMkq5ZrI3tzDxPy3zDLg5jxMoTsVj+CpAbBbNVcnu9HVoH?= =?iso-8859-1?Q?oa64KZfta69DcUQU+zuCNal5uPbeNJQLlKcGbGy/M0EQlwc5x9+32xrbmi?= =?iso-8859-1?Q?0Ib8A2Z+5Pq5ISQxW3thiTgAYgL3hzHWCJelhRT5qjicaIOUsfhFDau+f3?= =?iso-8859-1?Q?mGrjJG0qPbD8u/mXz4cD9BX+T0uMYbPx4EIrLStxiJ5TmhrwGA3r4rcyTc?= =?iso-8859-1?Q?Ol40UcKcLOi+E3Go2kz+wTXr1rXjZNOVOha10gQqt+fqy11J9CeJIWooVg?= =?iso-8859-1?Q?D2wcH9n9Y2aYLM9ElsG/m6MfIa68BZhjNazjHlMbvGiMwLz/sID+wt4FEf?= =?iso-8859-1?Q?JximwdpozESwKRvx77vvJwUWGEYyMg5yQWN3/IphUmy/4GiVlCQGKYAaCE?= =?iso-8859-1?Q?Tp+cu1gASSArknl4O7sQ3Io5WGtfs7elGiqSdbg0HIfL67cH614dKoA7cq?= =?iso-8859-1?Q?+wso/66uZsiIpAV4QhJYlSntaiQ51BssOCnrG0v5CF3ZEtuYSMojMFOlAJ?= =?iso-8859-1?Q?Erm9rcOdOkRWdJfsYRtNJpO5inMIRLiDrnPv7YIHYCXXA9+FXFWbj4iA?= =?iso-8859-1?Q?=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e97c6e99-e952-468c-aed4-08da69f6249a X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2022 02:17:56.0711 (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: nHj9VKuAZ/KMqHiCH19K6EZc3gNSAHCTdPdsG+BYa5kjLFwq9DLEyz/h9ToDreQOfNEEiFN+gBsmX1ClN6sKmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6316 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-19_10,2022-07-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207200008 X-Proofpoint-ORIG-GUID: RUQ4_XYJDmmF2HFDXJBiuga5SwfIOK9x X-Proofpoint-GUID: RUQ4_XYJDmmF2HFDXJBiuga5SwfIOK9x X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Matthew Wilcox (Oracle)" Use the VMA iterator instead. This requires a little restructuring of the surrounding code to hoist the mm to the caller. That turns cxl_prefault_one() into a trivial function, so call cxl_fault_segment() directly. Link: https://lkml.kernel.org/r/20220504011345.662299-22-Liam.Howlett@oracl= e.com Link: https://lkml.kernel.org/r/20220621204632.3370049-38-Liam.Howlett@orac= le.com Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka Cc: Catalin Marinas Cc: David Howells Cc: SeongJae Park Cc: Will Deacon Cc: Davidlohr Bueso Signed-off-by: Andrew Morton --- drivers/misc/cxl/fault.c | 45 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c index 60c829113299..2c64f55cf01f 100644 --- a/drivers/misc/cxl/fault.c +++ b/drivers/misc/cxl/fault.c @@ -280,22 +280,6 @@ void cxl_handle_fault(struct work_struct *fault_work) mmput(mm); } =20 -static void cxl_prefault_one(struct cxl_context *ctx, u64 ea) -{ - struct mm_struct *mm; - - mm =3D get_mem_context(ctx); - if (mm =3D=3D NULL) { - pr_devel("cxl_prefault_one unable to get mm %i\n", - pid_nr(ctx->pid)); - return; - } - - cxl_fault_segment(ctx, mm, ea); - - mmput(mm); -} - static u64 next_segment(u64 ea, u64 vsid) { if (vsid & SLB_VSID_B_1T) @@ -306,23 +290,16 @@ static u64 next_segment(u64 ea, u64 vsid) return ea + 1; } =20 -static void cxl_prefault_vma(struct cxl_context *ctx) +static void cxl_prefault_vma(struct cxl_context *ctx, struct mm_struct *mm= ) { u64 ea, last_esid =3D 0; struct copro_slb slb; + VMA_ITERATOR(vmi, mm, 0); struct vm_area_struct *vma; int rc; - struct mm_struct *mm; - - mm =3D get_mem_context(ctx); - if (mm =3D=3D NULL) { - pr_devel("cxl_prefault_vm unable to get mm %i\n", - pid_nr(ctx->pid)); - return; - } =20 mmap_read_lock(mm); - for (vma =3D mm->mmap; vma; vma =3D vma->vm_next) { + for_each_vma(vmi, vma) { for (ea =3D vma->vm_start; ea < vma->vm_end; ea =3D next_segment(ea, slb.vsid)) { rc =3D copro_calculate_slb(mm, ea, &slb); @@ -337,20 +314,28 @@ static void cxl_prefault_vma(struct cxl_context *ctx) } } mmap_read_unlock(mm); - - mmput(mm); } =20 void cxl_prefault(struct cxl_context *ctx, u64 wed) { + struct mm_struct *mm =3D get_mem_context(ctx); + + if (mm =3D=3D NULL) { + pr_devel("cxl_prefault unable to get mm %i\n", + pid_nr(ctx->pid)); + return; + } + switch (ctx->afu->prefault_mode) { case CXL_PREFAULT_WED: - cxl_prefault_one(ctx, wed); + cxl_fault_segment(ctx, mm, wed); break; case CXL_PREFAULT_ALL: - cxl_prefault_vma(ctx); + cxl_prefault_vma(ctx, mm); break; default: break; } + + mmput(mm); } --=20 2.35.1