Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp348169ybt; Wed, 24 Jun 2020 00:23:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ7V0hqkMUf/rSw2c3vLicVR8IAhwe6Dd3oOMP5e/oOLrpRZvoU4To/iWAEQ7OMmlr4/vD X-Received: by 2002:a17:906:af76:: with SMTP id os22mr22701128ejb.191.1592983396152; Wed, 24 Jun 2020 00:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592983396; cv=none; d=google.com; s=arc-20160816; b=jLVIsb9pd70eS3PyOYd5IBxntc2VUy+0q91BEu8kMobX4pvDVrlaQHYrDJ0QI4Lz1F mKj5xtd1kftIJNkrNypO1EbL6V1+subaoiUx1aiUJzfkKD9EgUR/BTV6BoYli+bjszzB 3AupPMeZKH8OATJvAt3xlXf93N1U6LPTpKsPT+pIbal32oPs6ccr8b9jBYBcYdVUAxS8 WEnfUZKJahRurrZ0UntDlJiKUtvYJFSqV3BUO8CfjKJX3K4lUmDQqu6pbN5YVd9v3Q55 A35BQSgV7oBLKPpgbFLrROlbXKsxJq+3mvyyLqUSTbEEhRJb412Qic9ossJPDAk4SR9A em5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HGtzQfwQwziDP/E8tZ2PycPrlPXYpKHj0jUufdCjEeM=; b=H4kxlZOEGQvO4xEmWMEcDH3+47ZQVfAoVrQDkFIuKIItiKG3uIvEksr2ZZiRj/4gC3 gszaTKe5KoOGknsHsMNyuVHlWFoJ98vzaetzxks9mZLYPqjf37c+Q4aTBLlGr+r2bVBz /VA9JXr82eCz82Fi4gZIXFgFqMTpAfRyTQtb7lfk8bsMFHqNdIEieVF97NBGi4OinEYl KpFNITOLh1F3Kn3lxHKTEZIzlM9jhm+VOI8q7RC6XM4+2GofDnU9Ge/PlEBvKEOYhTGW hSlu39dKd44yllcVT6WqcfukuRfxD0AmfY9+1BomX/WB8HFwI0DhU3lxn94tCXAHyQfY 9PHw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c14si13170844edl.273.2020.06.24.00.22.52; Wed, 24 Jun 2020 00:23:16 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389635AbgFXHWE (ORCPT + 99 others); Wed, 24 Jun 2020 03:22:04 -0400 Received: from verein.lst.de ([213.95.11.211]:43123 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728360AbgFXHWD (ORCPT ); Wed, 24 Jun 2020 03:22:03 -0400 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?