Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031572AbdIZSfd (ORCPT ); Tue, 26 Sep 2017 14:35:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54108 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754205AbdIZSfb (ORCPT ); Tue, 26 Sep 2017 14:35:31 -0400 Date: Tue, 26 Sep 2017 13:35:22 -0500 From: Reza Arbab To: Michal Hocko Cc: Andrew Morton , Jan Kara , Ross Zwisler , "Kirill A. Shutemov" , Lorenzo Stoakes , Dave Jiang , =?iso-8859-1?B?Suly9G1l?= Glisse , 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 References: <1506111236-28975-1-git-send-email-arbab@linux.vnet.ibm.com> <20170926133707.wquyw3ic5nbmfjuo@dhcp22.suse.cz> <20170926144710.zepvnyktqjomnx2n@arbab-laptop.localdomain> <20170926163241.5rd4wyzrzoso4uto@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20170926163241.5rd4wyzrzoso4uto@dhcp22.suse.cz> Organization: IBM Linux Technology Center User-Agent: NeoMutt/20170914 (1.9.0) X-TM-AS-GCONF: 00 x-cbid: 17092618-0024-0000-0000-000002D8802B X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007797; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000231; SDB=6.00922738; UDB=6.00463816; IPR=6.00702880; BA=6.00005608; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017284; XFM=3.00000015; UTC=2017-09-26 18:35:30 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092618-0025-0000-0000-0000458C7F94 Message-Id: <20170926183522.zeky6yfjdbuistso@arbab-laptop.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-26_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709260262 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2037 Lines: 49 On Tue, Sep 26, 2017 at 04:32:41PM +0000, Michal Hocko wrote: >On Tue 26-09-17 09:47:10, 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(); > >OK, but do all the HMM devices have concept of NUMA affinity? From the >code you are pasting they do not have to... I don't know the definitive answer here, but as Jerome said PCIE devices should, and we are heading that way with NVLink/CAPI as well. It seems the default is just the nearest node. >> 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. > >I am just worried that we allow information which is not generally >sensible and I am also not sure what the userspace can actually do with >that information. As mentioned, it is minimally useful, e.g. for verifying migration, so returning the nid seems sensible to me. Alternatively, we might at least change the documentation to say -EFAULT This is a zero page, a device page, or the memory area is not mapped by the process. ^^^^^^^^^^^^^ -- Reza Arbab