From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4011BC4361B for ; Tue, 8 Dec 2020 13:24:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C9BC423AA8 for ; Tue, 8 Dec 2020 13:24:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9BC423AA8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9BFFE6B005C; Tue, 8 Dec 2020 08:24:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9494F6B005D; Tue, 8 Dec 2020 08:24:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 811DF6B0068; Tue, 8 Dec 2020 08:24:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id 63FCE6B005C for ; Tue, 8 Dec 2020 08:24:39 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2778B1EE6 for ; Tue, 8 Dec 2020 13:24:39 +0000 (UTC) X-FDA: 77570184678.01.geese09_3b05781273e7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 054DD10048400 for ; Tue, 8 Dec 2020 13:24:38 +0000 (UTC) X-HE-Tag: geese09_3b05781273e7 X-Filterd-Recvd-Size: 5677 Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 13:24:38 +0000 (UTC) Received: by mail-qv1-f67.google.com with SMTP id q7so8165351qvt.12 for ; Tue, 08 Dec 2020 05:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=T1isYDgNOE+W2Se2WweJvNcMIu/bUl82g6ebJ/LNKcU=; b=LxiKONrQHdtHhwSGFXZbRrBSyEbPrU5yj811v9vs/vE+7qDYrFlwKV99EXr0Q3cRIk vQ+ymv1wxeFAsKN5nVMpAhAFLIqt9DMP8du1lYrtrd5VH0ufoGaKqBhpiLsURwjMCqF2 qRpOJ6BxfCYE9CaXCtbkxpgeoLa8DXrYBePbsePjEaKn+tz0WaerXDo7YN+SUwUUQlXc rAMMs9J3CCrWKCJYfZ62lpdjH6kDaBur1+NHAhqkCmyJbWAR8pfZmCw/Yon8NEJItu8s DA7apEDLUKx8XQG9q86aBb5NRzqMSOnHYvx4TTQVlXtwgkir3fwmQsPcP49C5sNTckAf DzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=T1isYDgNOE+W2Se2WweJvNcMIu/bUl82g6ebJ/LNKcU=; b=drJkXrJsoCJmykYe6/1rBStJvfBIhkFCywcQ34DSohYKVzQYJYfRtfDHV1xTU9Nm+G p0bc1BsSxkJAiMGE/V25zJsU5tkl7GB5ZzqAK3CsgG5fikVlewifyNFpA18irWUHcb7F +zIbvj5ewIsdXMXBwoNDLAr2HEAkBDLk+Z7gL1VJLTG60Y4Jkoy3B6HexhipZqnhS4b4 v2KCp0C0NDN/cOmQXnhnObhJ4XltceyzbUo0hT3YwPsG89To3VwQL6TCL7/wcuNwfXJ+ dWaoA+9H2Iz3A/Ox6NseqBRhPbBYYkknwBmOImRxojV/WcIvlyLFSJBC1BCbtnqGe+Mg DY1w== X-Gm-Message-State: AOAM530y+eBriWYIqt0A0bF0Kl/5CiR/ngcG5858rjXPxOz4v+/aKOf2 KjDnFhptHKH57psNuYcsV1T9MA== X-Google-Smtp-Source: ABdhPJyZJY645sm/nFuVEPVllkY/fRaekelCSSUjYfDlrFnd8MBXK6r0R4EqyY4TOyZ1JvnvCgY8sA== X-Received: by 2002:ad4:4e09:: with SMTP id dl9mr2942254qvb.44.1607433877750; Tue, 08 Dec 2020 05:24:37 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id h9sm984790qkk.33.2020.12.08.05.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 05:24:36 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kmcyp-007uB3-Qi; Tue, 08 Dec 2020 09:24:35 -0400 Date: Tue, 8 Dec 2020 09:24:35 -0400 From: Jason Gunthorpe To: Daniel Jordan Cc: Pavel Tatashin , 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 Message-ID: <20201208132435.GN5487@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> <87360lnxph.fsf@oracle.com> <20201204205233.GF5487@ziepe.ca> <87k0ttrp0v.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k0ttrp0v.fsf@oracle.com> 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: On Mon, Dec 07, 2020 at 09:48:48PM -0500, Daniel Jordan wrote: > Jason Gunthorpe writes: > > On Fri, Dec 04, 2020 at 03:05:46PM -0500, Daniel Jordan wrote: > >> 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. > > > > iommu restrictions are not related to with gup. vfio needs to get the > > page list from the page tables as efficiently as possible, then you > > break it up into what you want to feed into the IOMMU how the iommu > > wants. > > > > vfio must maintain a page list to call unpin_user_pages() anyhow, so > > It does in some cases but not others, namely the expensive > VFIO_IOMMU_MAP_DMA/UNMAP_DMA path where the iommu page tables are used > to find the pfns when unpinning. Oh, I see.. Well, that is still possible, but vfio really needs to batch operations, eg call pin_user_pages() with some larger buffer and store those into the iommu and then reverse this to build up contiguous runs of pages to unpin > I don't see why vfio couldn't do as you say, though, and the worst case > memory overhead of using scatterlist to remember the pfns of a 300g VM > backed by huge but physically discontiguous pages is only a few meg, not > bad at all. Yes, but 0 is still better.. I would start by focusing on batching pin_user_pages. Jason