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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 3D58BC433DF for ; Wed, 24 Jun 2020 07:22:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E22F4207DD for ; Wed, 24 Jun 2020 07:22:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E22F4207DD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4AF306B0002; Wed, 24 Jun 2020 03:22:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45EAD6B0003; Wed, 24 Jun 2020 03:22:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34E4F6B0005; Wed, 24 Jun 2020 03:22:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 1A70D6B0002 for ; Wed, 24 Jun 2020 03:22:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B68091EE6 for ; Wed, 24 Jun 2020 07:22:05 +0000 (UTC) X-FDA: 76963261410.16.offer04_0c0c53d26e42 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 900B5100E6903 for ; Wed, 24 Jun 2020 07:22:05 +0000 (UTC) X-HE-Tag: offer04_0c0c53d26e42 X-Filterd-Recvd-Size: 2562 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 07:22:04 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 17DCE68B02; Wed, 24 Jun 2020 09:22:01 +0200 (CEST) Date: Wed, 24 Jun 2020 09:22:00 +0200 From: Christoph Hellwig To: Ralph Campbell Cc: Christoph Hellwig , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jerome Glisse , John Hubbard , Jason Gunthorpe , Andrew Morton Subject: Re: [RESEND PATCH] mm: fix migrate_vma_setup() src_owner and normal pages Message-ID: <20200624072200.GA18609@lst.de> References: <20200622222008.9971-1-rcampbell@nvidia.com> <20200623114018.GA17496@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 900B5100E6903 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Tue, Jun 23, 2020 at 10:05:19AM -0700, Ralph Campbell wrote: > > On 6/23/20 4:40 AM, Christoph Hellwig wrote: >> On Mon, Jun 22, 2020 at 03:20:08PM -0700, Ralph Campbell wrote: >>> The caller of migrate_vma_setup() does not know what type of page is >>> stored in the CPU's page tables. Pages within the specified range are >>> free to be swapped out, migrated, or freed until after migrate_vma_setup() >>> returns. The caller needs to set struct migrate_vma.src_owner in case a >>> page is a ZONE device private page that the device owns and might want to >>> migrate. However, the current code skips normal anonymous pages if >>> src_owner is set, thus preventing those pages from being migrated. >>> Remove the src_owner check for normal pages since src_owner only applies >>> to device private pages and allow a range of normal and device private >>> pages to be migrated. >> >> src_owner being set means we want to migrate from device private >> memory to normal host DRAM. What kind of problem do you see of >> not touching already present pages in that path? >> > > The problem is that migrate_vma_setup() invalidates the address range so any > previously migrated pages to device private memory have to be faulted in > again. By having the PFN of those device private pages in the src array, the > driver can reinstate the device MMU mappings and avoid the page faults. Maybe add that to the changelog?