From: Tim Deegan Subject: Re: [PATCH v4 1/4] xen: introduce a helper to allocate non-contiguous memory Date: Thu, 7 May 2015 16:22:26 +0100 Message-ID: <20150507152226.GH40948@deinos.phlegethon.org> References: <1431008976-20414-1-git-send-email-roger.pau@citrix.com> <1431008976-20414-2-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqNd8-00063x-54 for xen-devel@lists.xenproject.org; Thu, 07 May 2015 15:22:30 +0000 Content-Disposition: inline In-Reply-To: <1431008976-20414-2-git-send-email-roger.pau@citrix.com> 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 Cc: xen-devel@lists.xenproject.org, Ian Campbell , Jan Beulich , Andrew Cooper List-Id: xen-devel@lists.xenproject.org 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. Cheers, Tim.