Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp539251ybl; Sat, 17 Aug 2019 05:53:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTx+o/XJ5FRPJ65AogJ1xzwM8/s1f7cuOWUCJuGV9ohzA2mCbmJjQl3yX856Dbfj4hy7Bk X-Received: by 2002:a17:902:7c10:: with SMTP id x16mr7826571pll.31.1566046416535; Sat, 17 Aug 2019 05:53:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1566046416; cv=pass; d=google.com; s=arc-20160816; b=bTDrJEduNouxEyUaAMV+ih7yZVK9cF/wSlV+tm7WesY5221R62ud6jDVT4M/RzyPXU bILJdp/OmH/Xu2aDWKoNlHO0vAVbMB/15vd8kPc3k8pK2hEv53FoT6T7oHgQGZ9F5Plr qqkHlUF45w4ADSZlv+pZJPh6IoiCbZtLatxcwASli6R/UyUSanC2oXKsOpL0nJdK6WsE ZuFW8OKEzoSXNIpJcoQ/RydcZzOeZH2Jh/m4QPH4Gbac2QHH0Bjzt4yyZ7/DYcsEoOKW Qw6S5b3UmYurDrpC/zbznLLQx/aGLseooP7CTqCsmgstrfoZDLZlKH/dT49g/CKK6Rai uw8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=xBnKmRLyCwxqWMxqtYtaxBjRMqaAzEVPpluFObk7JBI=; b=e//KderUf0WqxtpzLQVhbIOOs1PYmTqL8M6pwt/JR/ReJL2R2oUy/kBvK/0hgQelkV vUrCLJcYdKt3jRlXnfMMNbSdB6UdIQNOhw0lOvMMndcxmMk7L/5No9OQ1UJxYWPSeuKk 42px1EcVWHilhFXvHwLoQoLHSI5b3KxG7DT8b8G/tSR1kluRYI1cF5sBuGQjs1r7zDSu lHyQwQAOPvVcxhIcLC0WIMgKnnyLvDVr7v8nUHgFKN7nnufDdHxJFy2E1TER3OoUX74y UEyfTn15O+Q0MhAxxOAwaD7SXmcFDNrpV+xpe3UYJX/f6M6aq5Bs0KmC1US9iytoJreM HG6g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector2 header.b=E5h62KTp; arc=pass (i=1 spf=pass spfdomain=mellanox.com dkim=pass dkdomain=mellanox.com dmarc=pass fromdomain=mellanox.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si6709338pfq.88.2019.08.17.05.52.52; Sat, 17 Aug 2019 05:53:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector2 header.b=E5h62KTp; arc=pass (i=1 spf=pass spfdomain=mellanox.com dkim=pass dkdomain=mellanox.com dmarc=pass fromdomain=mellanox.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbfHQMuL (ORCPT + 99 others); Sat, 17 Aug 2019 08:50:11 -0400 Received: from mail-eopbgr10061.outbound.protection.outlook.com ([40.107.1.61]:8878 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725988AbfHQMuK (ORCPT ); Sat, 17 Aug 2019 08:50:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFNbMY32Ycu62r1bCxURHDABZxgMZvTWrapmSZEX2ulfx2zSvFHUSDI4NqZqt+rkYMHj8hi5zvyHVLcBGFZINrI6YE9ynBkW/69cJQuCHfmalz0jQb4rVDbKZgjBtJVUhfrCSt9uDTuytkRWzypw0tRMSRbF/DN4lXFA6hTaMMwyNf8bJQcXQGriBtVeMk3kDVH/0hwz4ggHNADEz/FEYB7o6dgdqaR3liNpc3RK2RPF2iqPqAjtUBYTbwwyXxxWXGY1Q+l3LJcFfOc7rDYZFAelbWJvvVltm/3Sip/noE5x+jiQ1MHJ48nwJgrR+Q0yEfULNN2am2QjcznGL3riOA== 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-SenderADCheck; bh=xBnKmRLyCwxqWMxqtYtaxBjRMqaAzEVPpluFObk7JBI=; b=cPRdZSFtreNvKSFuRlf8wY/TTv3k50Hc93iLoqOCeg5OeBK5ubcqrLjeASDjLXUQ2e1HVArQwfa6aNCAHpKaLM0BVECH5qdcPfnVSIO88Beou1Tt71249yNmIu2EMY7W/flPXzlpsHlXfLpEKfiTS3AQbs5b+oA87IAQ0uc37cWF/+iwNuDkCqepAqHTA8j/k2UB6uPKJIm7hlzPtWr06xF9ybht9nfFaF3/NkPMnOZdN8xp55FyRBhV5cCDvgcUeopQ9dlxdgLZkib1+8eWW7Rnvzb27lZnXybmrpuaa6uSR5N8FOhtAk0jMwDf83P45RpcMCUbtjUYQxC/AZI4Gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xBnKmRLyCwxqWMxqtYtaxBjRMqaAzEVPpluFObk7JBI=; b=E5h62KTphx3fmnZnqZZPNrG2W+s15qxVT8fHXjtukqhwrJif3z07tmSm1iwfrTDQUCS4fEogir7raCmv9s/R7YV1jBYkNYeh0dHxP2ttuN+Wdd+lP4eU3K2b2d3t1wv5hWtNV6d2AOEU7Fp8sPn+pgjUvvz0TswCpZ0AfPSWkPg= Received: from VI1PR05MB4141.eurprd05.prod.outlook.com (10.171.182.144) by VI1PR05MB5311.eurprd05.prod.outlook.com (20.178.8.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Sat, 17 Aug 2019 12:50:06 +0000 Received: from VI1PR05MB4141.eurprd05.prod.outlook.com ([fe80::1d6:9c67:ea2d:38a7]) by VI1PR05MB4141.eurprd05.prod.outlook.com ([fe80::1d6:9c67:ea2d:38a7%6]) with mapi id 15.20.2178.016; Sat, 17 Aug 2019 12:50:06 +0000 From: Jason Gunthorpe To: Christoph Hellwig CC: =?iso-8859-1?Q?J=E9r=F4me_Glisse?= , Ben Skeggs , Ralph Campbell , Bharata B Rao , Andrew Morton , "linux-mm@kvack.org" , "nouveau@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 01/10] mm: turn migrate_vma upside down Thread-Topic: [PATCH 01/10] mm: turn migrate_vma upside down Thread-Index: AQHVUnY4TvdvZdqG70SoVm3XhXkEbab+BjuAgAEzdgCAABX0AA== Date: Sat, 17 Aug 2019 12:50:06 +0000 Message-ID: <20190817125002.GB10068@mellanox.com> References: <20190814075928.23766-1-hch@lst.de> <20190814075928.23766-2-hch@lst.de> <20190816171101.GK5412@mellanox.com> <20190817113128.GA23295@lst.de> In-Reply-To: <20190817113128.GA23295@lst.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: YTXPR0101CA0069.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:1::46) To VI1PR05MB4141.eurprd05.prod.outlook.com (2603:10a6:803:4d::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jgg@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [156.34.55.100] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a6dd676e-d353-45d8-2e8e-08d723116df6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:VI1PR05MB5311; x-ms-traffictypediagnostic: VI1PR05MB5311: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0132C558ED x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(136003)(366004)(396003)(39860400002)(189003)(199004)(6246003)(76176011)(386003)(478600001)(25786009)(446003)(186003)(86362001)(99286004)(102836004)(6506007)(316002)(6512007)(1076003)(66066001)(14454004)(26005)(52116002)(486006)(4744005)(5660300002)(11346002)(476003)(2616005)(7416002)(256004)(305945005)(71200400001)(71190400001)(33656002)(7736002)(6116002)(81166006)(8936002)(36756003)(81156014)(6486002)(8676002)(229853002)(53936002)(66476007)(66556008)(4326008)(64756008)(2906002)(3846002)(66446008)(6916009)(66946007)(6436002)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR05MB5311;H:VI1PR05MB4141.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Vlg8j145DMCic0yKX8M55cA/znV95y7LwbgWTEb5V0oTNzuOES/RUEw7fJF0WGnLUVEIqwDfvihM07pkp5D8C8wv+fDuMbOIAY5Tr/WC4oLLgCPTRMhM6FwBFpEQKcXiFmFNvvLW0lujg0LxH0NahHY7lCRucgP/xZbi5asYTku5DxdDcC7xhRDbIm5E70dLwMHslGv2uFCatqbtiOfixIelAfH2M8TjHbqZecb6oFFuvwxXUJKsrpsHOserO/k3uXQ+2g9n48qS4EVHfiPA1k96zIv2RFAMyNUTpAphFVSQCuLoSR5M0JZpmJINt84y2MORaMNhJwUHtk288UHDafyP7KXTazzqSMKsk+on6hfTIcH2398HOD23XV89QnKtKFbrHmWnhtge7ijlxSP26PUFTkOLssKRTbmG9BG3GWg= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-ID: <1695A1151C0F3641B6BBDBD97CAD2365@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6dd676e-d353-45d8-2e8e-08d723116df6 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2019 12:50:06.3920 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EKbtjcdg48Acrsg7vuLj3RsaBb93XGMzGcoKoIlnd/brgbVOLdhA7UfwMUk7gN0gLJX7vy6ZDXTc7Kal2bGWHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5311 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 17, 2019 at 01:31:28PM +0200, Christoph Hellwig wrote: > On Fri, Aug 16, 2019 at 05:11:07PM +0000, Jason Gunthorpe wrote: > > - if (args->cpages) > > - migrate_vma_prepare(args); > > - if (args->cpages) > > - migrate_vma_unmap(args); > > + if (!args->cpages) > > + return 0; > > + > > + migrate_vma_prepare(args); > > + migrate_vma_unmap(args); >=20 > I don't think this is ok. Both migrate_vma_prepare and migrate_vma_unmap > can reduce args->cpages, including possibly to 0. Oh, yes, that was far too hasty on my part, I had assumed collect set the cpages. Thank you for checking Jason