From: "Jan Beulich" Subject: Re: [PATCH v4 1/4] xen: introduce a helper to allocate non-contiguous memory Date: Thu, 07 May 2015 16:52:17 +0100 Message-ID: <554BA6510200007800077C27@mail.emea.novell.com> References: <1431008976-20414-1-git-send-email-roger.pau@citrix.com> <1431008976-20414-2-git-send-email-roger.pau@citrix.com> <20150507152226.GH40948@deinos.phlegethon.org> <20150507153223.GK40948@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqO61-0002ci-9J for xen-devel@lists.xenproject.org; Thu, 07 May 2015 15:52:21 +0000 In-Reply-To: <20150507153223.GK40948@deinos.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne , Tim Deegan Cc: Andrew Cooper , Ian Campbell , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 07.05.15 at 17:32, wrote: > At 16:22 +0100 on 07 May (1431015746), Tim Deegan wrote: >> At 16:29 +0200 on 07 May (1431016173), Roger Pau Monne wrote: >> > The allocator uses independent calls to alloc_heap_pages in order to get > the >> > desired amount of memory and then maps all the independent physical >> > addresses into a contiguous virtual address space. >> > >> > In order to keep track of this regions a red-black tree is used. >> >> On x86, at least, the vmap apparatus should be able to tell you what >> MFN is mapped by using the linear map to look at the l1e. On ARM, it >> looks like we could walk the xen pagetable trie from xen_second[] for >> the same effect. >> >> So I'd suggest adding a vmap_to_mfn() and usign that instead of >> building the red-black tree. > > Also: does this need a clear_page() somewhere to scrub the allocation? > If not here, I think it's needed in patches 2 and 3 where you're > replacing xzalloc (unless you're sure that the loop will write every > byte of the allocation, in which case xzalloc was overkill). Just like we have xmalloc() and xzalloc() I think we should have vmalloc() and vzalloc(). Jan