Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2880529pxu; Mon, 7 Dec 2020 19:35:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUMeZeCN8XKAVw68vowLekooK53xAYAD4N38rOZUGoTdG+fgGG3kMWEIEGjPokYBN00+k8 X-Received: by 2002:a17:906:3102:: with SMTP id 2mr21761671ejx.135.1607398518959; Mon, 07 Dec 2020 19:35:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607398518; cv=none; d=google.com; s=arc-20160816; b=QDlNkY10a4I23Cuh7JENV9Yu9Q4v0gqEATI+xU2gTWfwDEX7gL3mvNhRMZXsMbGzIT 7WnKG2G51c9bqcSSSdqBcuEnj8hzZFRJ6O3Vs8FHwYQCF3JPFUVTpUJz6RlGqipUSzci hwKBXxZmulejx/BUcHR4MIoOrKurldNGdb/hCkfLn2Okgbaf/LOw27g2mB8ZxnLLcMTV I4m165GC3HmxLm6sxyzFTNFvw+shco2yd8X3REmokJVhm3RLc2ZP60BjIZDu34jH6N07 TlWtIZWDCg19vYmM0+68PBAimyHqABavBBRZ+SdcNzePTxW5QoqA0hAg1OpS5lRAUikE TSQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=NWKyHUi7PYTSOlwujvcie0KSCx6tBO6Zs/Me8zeBfwo=; b=E5neT28E2dtBk9gqfmluoyPVRwx3ysG3C4N6S2Dbn4TkUw+vhb4HG/LrmQ9qgi4yF2 NzSr7uKQYHyFUCy4K0xKmVSzQo5jgdLZW97kGy3MhtBe8ehZ8jsbEoXGRZSPes8ZRW5N SuNqKPBhZlwB5kcxC3Vm2Mo900gMXX+xfqOqtJYO5tWcKo2KLGtYRGjP+2jVfjzfcwGq 1hsbWVyypEEbmdy/1DMW3kCZYe8qaueHYQZxs31nwskxkde6zFmGUOS7vFkmnqO5r3NA hTujz62Uo5mIT98C8mhkIpC1Fep0czIQLEHKQt0IAcf7h5yzEpT9vM9BSJqNZhF7i+Rf QsyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SqljVh79; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si8095621edt.440.2020.12.07.19.34.56; Mon, 07 Dec 2020 19:35:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SqljVh79; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727721AbgLHC3L (ORCPT + 99 others); Mon, 7 Dec 2020 21:29:11 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:46374 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgLHC3K (ORCPT ); Mon, 7 Dec 2020 21:29:10 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B82PFhO175146; Tue, 8 Dec 2020 02:27:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=corp-2020-01-29; bh=NWKyHUi7PYTSOlwujvcie0KSCx6tBO6Zs/Me8zeBfwo=; b=SqljVh79ZJ7JIofga3LSjYd6IlNV7jnTrcUJHU5zUO3RA5Si9GVMj8fMeL+2rv00S+DP WB9EGT43pi3z8uk2PBXpZNy9bT4NpCf6hYT7ccIpKSiA9xgptpiJZ3B4NhvAmMmBlbRO UqlueZsNeej8zQ32WLE7/12hGYFUIB5unH86wajP3VwHGqjb9RW+/+1R4Ul1e9Ye6Ip7 rD0Iac24aDDSFsQb/ggvCXfWmgF7fPMltgxAM5oH48cRqjmK1R46abT0rw41Gg1toAzq vU4gvFQkgpyC2mC3DcPBJXf8mjhaUknHJgOOXqs5a5IhpQJ6qZAi3uSa7giA3zdgEdL+ iA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 35825m0gk3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 08 Dec 2020 02:27:31 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B82OkZ4078161; Tue, 8 Dec 2020 02:27:31 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 358ksmy0fb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Dec 2020 02:27:31 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0B82RQfx029524; Tue, 8 Dec 2020 02:27:26 GMT Received: from parnassus (/98.229.125.203) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Dec 2020 18:27:25 -0800 From: Daniel Jordan To: Pavel Tatashin Cc: Jason Gunthorpe , Alex Williamson , LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard Subject: Re: [PATCH 6/6] mm/gup: migrate pinned pages out of movable zone In-Reply-To: References: <20201202052330.474592-1-pasha.tatashin@soleen.com> <20201202052330.474592-7-pasha.tatashin@soleen.com> <20201202163507.GL5487@ziepe.ca> <20201203010809.GQ5487@ziepe.ca> <20201203141729.GS5487@ziepe.ca> <87360lnxph.fsf@oracle.com> Date: Mon, 07 Dec 2020 21:27:20 -0500 Message-ID: <87zh2phw1j.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9828 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=1 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012080013 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9828 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 mlxscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012080013 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Tatashin writes: > On Fri, Dec 4, 2020 at 3:06 PM Daniel Jordan wrote: >> >> Jason Gunthorpe writes: >> >> > On Wed, Dec 02, 2020 at 08:34:32PM -0500, Pavel Tatashin wrote: >> >> What I meant is the users of the interface do it incrementally not in >> >> large chunks. For example: >> >> >> >> vfio_pin_pages_remote >> >> vaddr_get_pfn >> >> ret = pin_user_pages_remote(mm, vaddr, 1, flags | >> >> FOLL_LONGTERM, page, NULL, NULL); >> >> 1 -> pin only one pages at a time >> > >> > I don't know why vfio does this, it is why it so ridiculously slow at >> > least. >> >> Well Alex can correct me, but I went digging and a comment from the >> first type1 vfio commit says the iommu API didn't promise to unmap >> subpages of previous mappings, so doing page at a time gave flexibility >> at the cost of inefficiency. >> >> Then 166fd7d94afd allowed the iommu to use larger pages in vfio, but >> vfio kept pinning pages at a time. I couldn't find an explanation for >> why that stayed the same. >> >> Yesterday I tried optimizing vfio to skip gup calls for tail pages after >> Matthew pointed out this same issue to me by coincidence last week. >> Currently debugging, but if there's a fundamental reason this won't work >> on the vfio side, it'd be nice to know. > > Hi Daniel, > > I do not think there are any fundamental reasons why it won't work. I > have also thinking increasing VFIO chunking for a different reason: > > If a client touches pages before doing a VFIO DMA map, those pages > might be huge, and pinning a small page at a time and migrating a > small page at a time can break-up the huge pages. So, it is not only > inefficient to pin, but it can also inadvertently slow down the > runtime. Hi Pasha, I see, and I'm curious, do you experience this case where a user has touched the pages before doing a VFIO DMA map, and if so where? The usual situation on my side is that the pages are faulted in during pinning. Daniel