Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp659605pxu; Fri, 4 Dec 2020 12:11:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCRL1cG+CjFeRBzjcVmGoBcFqL0ZooXHAILDDQbijWUADgAzvcyZxjVWZT1Cw3tCb2kJlA X-Received: by 2002:a17:906:2b95:: with SMTP id m21mr8929214ejg.134.1607112711109; Fri, 04 Dec 2020 12:11:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607112711; cv=none; d=google.com; s=arc-20160816; b=wi3IIBxj19ZD3Zhp9MXcVVJWq0KhkPX2g4nf1WZfzBFU2KgvOA/q2zMjQzaaM7G7EM f5PE9T8IQ9g1p2kCnPbMiVvHYYzKkysMVD7oyAG5d4a09hielZ1rQ1Mf24Y/CVvppvx8 4OzV8ewCIHwWhjzSVfg+Og2Fm0jn/EQAz0VGy6TJnCkWncJDf+MCUxNvmR7mV0vmqFqs xVHHLHRxbDpxVwECt9ttLp4/0WpUZbO3Ck/0AgtY6dT4ItobLFaBmP6rtJ+47hRvjErX K4QUlATIaRqwQMyxcpE64rNuL/Ldv12OABm7DYi8QXQrnYRCPZEcQxDw0+C5I591AFlN AK7A== 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=QuZr977AjBYzbv+upnrOJsmyj3o07WB2T8vvWfzyq3E=; b=UYSF8h+ZYDViJ75Qn5QXDJDQNiovshTdKM4uLoOg/c7DI4Eg8B3s+t/V29YCyZ6boa HR6QBFGWUdCOOVCpMPYgPWLuzFX12UHRNsB95M8Po5ecVnu3hQ45Uebq7B0ozodBabEc yL6JsGZ0VOu3p1N6lS7TenjtB/cwznZho/IJLHfsP9pTf1v9ffVDWpgld+XnMmOUJ5t7 va3Riv4gnPrs7WzLp1vteNXnXW/zRKAc5D4xBC6yxb4eZH5tniPA/DcybXdThtYGo0v4 Pr5D6tjxiA3XMmEqxWaAba7aOlCH62//YmU3U3qv7nRmvEzfnGrTGQjztIJHeXyzm8/k PFMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=yUW1NLr5; 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 e16si2035668ejd.747.2020.12.04.12.11.27; Fri, 04 Dec 2020 12:11:51 -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=yUW1NLr5; 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 S1730336AbgLDUHg (ORCPT + 99 others); Fri, 4 Dec 2020 15:07:36 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:47338 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726021AbgLDUHg (ORCPT ); Fri, 4 Dec 2020 15:07:36 -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 0B4Jn5jc076980; Fri, 4 Dec 2020 20:05:59 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=QuZr977AjBYzbv+upnrOJsmyj3o07WB2T8vvWfzyq3E=; b=yUW1NLr55pB5u3wF/KjZKkRo7CjTpdkUIlkGHdwqHOgvKbCKgk/uou6QL+l2nHTqcIBh ZWNONdZ5G9/7o6dITR2ZiLfoBJp1KhJCww8N2iiI2PfXi1xlehsxXnRamvknMI3vTqTE +pMODnUvB2Ssr2m/rLwMzBc6d4Jxn8ufqHuevYeytVlsLgEc97Vv70HHghsOKfBx/CnZ OP4fiW52GSF8J1ZacpKckHhJ0c4hJtf5UzpAvHECjhSGHMT+l86hzeYYJ0+1URmI8Wei 6b+YSan2lRiPsqbvhPrVyhA2kP56IidMslg/y6WnmYy33nbP/whnQJuQn9U0sN7SR4wA FQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 353egm4wdd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 04 Dec 2020 20:05:59 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B4JoREc083330; Fri, 4 Dec 2020 20:05:59 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 3540ayjm1m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Dec 2020 20:05:58 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0B4K5sAe022512; Fri, 4 Dec 2020 20:05:55 GMT Received: from parnassus (/98.229.125.203) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 04 Dec 2020 12:05:51 -0800 From: Daniel Jordan To: Jason Gunthorpe , Pavel Tatashin , Alex Williamson Cc: 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: <20201203141729.GS5487@ziepe.ca> 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> Date: Fri, 04 Dec 2020 15:05:46 -0500 Message-ID: <87360lnxph.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9825 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=1 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012040114 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9825 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=1 phishscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1011 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012040114 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.