From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [RFC 9/9] prd: Add support for page struct mapping Date: Fri, 22 Aug 2014 07:36:18 -0700 Message-ID: <53F75562.7040100@intel.com> References: <53EB5536.8020702@gmail.com> <53EB5960.50200@plexistor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Boaz Harrosh , Ross Zwisler , linux-fsdevel , Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Sagi Manole , Yigal Korman Return-path: Received: from mga02.intel.com ([134.134.136.20]:3053 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932093AbaHVOgU (ORCPT ); Fri, 22 Aug 2014 10:36:20 -0400 In-Reply-To: <53EB5960.50200@plexistor.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 08/13/2014 05:26 AM, Boaz Harrosh wrote: > +#ifdef CONFIG_BLK_DEV_PMEM_USE_PAGES > +static int prd_add_page_mapping(phys_addr_t phys_addr, size_t total_size, > + void **o_virt_addr) > +{ > + int nid = memory_add_physaddr_to_nid(phys_addr); > + unsigned long start_pfn = phys_addr >> PAGE_SHIFT; > + unsigned long nr_pages = total_size >> PAGE_SHIFT; > + unsigned int start_sec = pfn_to_section_nr(start_pfn); > + unsigned int end_sec = pfn_to_section_nr(start_pfn + nr_pages - 1); Nit: any chance you'd change this to be an exclusive end? In the mm code, we usually do: unsigned int end_sec = pfn_to_section_nr(start_pfn + nr_pages); so the for loops end up + unsigned long phys_start_pfn; > + struct page **page_array, **mapped_page_array; > + unsigned long i; > + struct vm_struct *vm_area; > + void *virt_addr; > + int ret = 0; This is a philosophical thing, but I don't see *ANY* block-specific code in here. Seems like this belongs in mm/ to me. Is there a reason you don't just do this at boot and have to use hotplug at runtime for it? What are the ratio of pmem to RAM? Is it possible to exhaust all of RAM with 'struct page's for pmem?