Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967222AbdIZQUA (ORCPT ); Tue, 26 Sep 2017 12:20:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53952 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964791AbdIZQT6 (ORCPT ); Tue, 26 Sep 2017 12:19:58 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7E00CC0587F1 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jglisse@redhat.com Date: Tue, 26 Sep 2017 09:19:42 -0700 From: Jerome Glisse To: Reza Arbab Cc: Michal Hocko , Andrew Morton , Jan Kara , Ross Zwisler , "Kirill A. Shutemov" , Lorenzo Stoakes , Dave Jiang , Matthew Wilcox , Hugh Dickins , Huang Ying , Ingo Molnar , "Aneesh Kumar K.V" , James Morse , Naoya Horiguchi , Minchan Kim , Johannes Weiner , Will Deacon , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/device-public-memory: Enable move_pages() to stat device memory Message-ID: <20170926161941.GB3216@redhat.com> References: <1506111236-28975-1-git-send-email-arbab@linux.vnet.ibm.com> <20170926133707.wquyw3ic5nbmfjuo@dhcp22.suse.cz> <20170926144710.zepvnyktqjomnx2n@arbab-laptop.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170926144710.zepvnyktqjomnx2n@arbab-laptop.localdomain> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 26 Sep 2017 16:19:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1529 Lines: 37 On Tue, Sep 26, 2017 at 09:47:10AM -0500, Reza Arbab wrote: > On Tue, Sep 26, 2017 at 01:37:07PM +0000, Michal Hocko wrote: > > On Fri 22-09-17 15:13:56, Reza Arbab wrote: > > > The move_pages() syscall can be used to find the numa node where a page > > > currently resides. This is not working for device public memory pages, > > > which erroneously report -EFAULT (unmapped or zero page). > > > > > > Enable by adding a FOLL_DEVICE flag for follow_page(), which > > > move_pages() will use. This could be done unconditionally, but adding a > > > flag seems like a safer change. > > > > I do not understand purpose of this patch. What is the numa node of a > > device memory? > > Well, using hmm_devmem_pages_create() it is added to this node: > > nid = dev_to_node(device); > if (nid < 0) > nid = numa_mem_id(); > > I understand it's minimally useful information to userspace, but the memory > does have a nid and move_pages() is supposed to be able to return what that > is. I ran into this using a testcase which tries to verify that user > addresses were correctly migrated to coherent device memory. > > That said, I'm okay with dropping this if you don't think it's worthwhile. Just to add a data point, PCIE devices are tie to one CPU (architecturaly PCIE lane are connected to CPU at least on x86/ppc AFAIK) and thus to one numa node. Right now i am traveling but i want to check that this patch does not allow user to inadvertaly pin device memory page. I will look into it once i am back. Cheers, J?r?me