Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753215AbcKUG5d (ORCPT ); Mon, 21 Nov 2016 01:57:33 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59984 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbcKUG5c (ORCPT ); Mon, 21 Nov 2016 01:57:32 -0500 Subject: Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool to set of flags To: Jerome Glisse , Balbir Singh References: <1479493107-982-1-git-send-email-jglisse@redhat.com> <1479493107-982-2-git-send-email-jglisse@redhat.com> <20161121045352.GA7872@redhat.com> Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, John Hubbard , Russell King , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Martin Schwidefsky , Heiko Carstens , Yoshinori Sato , Rich Felker , Chris Metcalf , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" From: Anshuman Khandual Date: Mon, 21 Nov 2016 12:27:15 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20161121045352.GA7872@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112106-0044-0000-0000-00000202A74D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112106-0045-0000-0000-00000601F50A Message-Id: <58329ACB.6030700@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-21_05:,, 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-1609300000 definitions=main-1611210124 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2856 Lines: 67 On 11/21/2016 10:23 AM, Jerome Glisse wrote: > On Mon, Nov 21, 2016 at 11:44:36AM +1100, Balbir Singh wrote: >> >> >> On 19/11/16 05:18, J?r?me Glisse wrote: >>> Only usefull for arch where we support ZONE_DEVICE and where we want to >>> also support un-addressable device memory. We need struct page for such >>> un-addressable memory. But we should avoid populating the kernel linear >>> mapping for the physical address range because there is no real memory >>> or anything behind those physical address. >>> >>> Hence we need more flags than just knowing if it is device memory or not. >>> >> >> >> Isn't it better to add a wrapper to arch_add/remove_memory and do those >> checks inside and then call arch_add/remove_memory to reduce the churn. >> If you need selectively enable MEMORY_UNADDRESSABLE that can be done with >> _ARCH_HAS_FEATURE > > The flag parameter can be use by other new features and thus i thought the > churn was fine. But i do not mind either way, whatever people like best. Right, once we get the device memory classification right, these flags can be used in more places. > > [...] > >>> -extern int arch_add_memory(int nid, u64 start, u64 size, bool for_device); >>> + >>> +/* >>> + * For device memory we want more informations than just knowing it is device >> information >>> + * memory. We want to know if we can migrate it (ie it is not storage memory >>> + * use by DAX). Is it addressable by the CPU ? Some device memory like GPU >>> + * memory can not be access by CPU but we still want struct page so that we >> accessed >>> + * can use it like regular memory. >> >> Can you please add some details on why -- migration needs them for example? > > I am not sure what you mean ? DAX ie persistent memory device is intended to be > use for filesystem or persistent storage. Hence memory migration does not apply > to it (it would go against its purpose). Why ? It can still be used for compaction, HW errors etc where we need to move between persistent storage areas. The source and destination can be persistent storage memory. > > So i want to extend ZONE_DEVICE to be more then just DAX/persistent memory. For > that i need to differentatiate between device memory that can be migrated and > should be more or less treated like regular memory (with struct page). This is > what the MEMORY_MOVABLE flag is for. ZONE_DEVICE right now also supports struct page for the addressable memory, (whether inside it's own range or in system RAM) with this we are extending it to cover un-addressable memory with struct pages. Yes the differentiation is required. > > Finaly in my case the device memory is not accessible by the CPU so i need yet > another flag. In the end i am extending ZONE_DEVICE to be use for 3 differents > type of memory. > > Is this the kind of explanation you are looking for ?