Re: [PATCH 04/11] unpaged: unifdefed PageCompound

Hugh Dickins
2005-11-19T20:15:04Z

On Thu, 17 Nov 2005, David S. Miller wrote:
> From: Hugh Dickins <hugh@veritas.com>
> Date: Thu, 17 Nov 2005 19:32:40 +0000 (GMT)
>
> > That's just what PageCompound is designed for, but it's been kept under
> > CONFIG_HUGETLB_PAGE. Remove the #ifdefs: which saves some space (out-
> > of-line put_page), doesn't slow down what most needs to be fast (already
> > using hugetlb), and unifies the way we handle high-order pages.
> >
> > Signed-off-by: Hugh Dickins <hugh@veritas.com>
>
> I think this is a good change regardless of the VM_RESERVED issues.
>
> I've been wanting to use this facility in some sparc64 bits in
> the past, for example. But since it was HUGETLB guarded that
> wasn't possible.

I've only just found that we have to supply the __GFP_COMP flag to get
this working. And one of the routes through snd_dma_alloc_pages goes
to sbus_alloc_consistent. Would you be happy for me to send Andrew a
patch with sparc and sparc64 sbus_alloc_consistent including __GFP_COMP?
Ought I to do the same in the sparc and sparc64 pci_alloc_consistent??

Thanks,
Hugh

--- 2.6.15-rc1-mm2/arch/sparc/kernel/ioport.c 2005-06-17 20:48:29.000000000 +0100
+++ linux/arch/sparc/kernel/ioport.c 2005-11-19 19:11:04.000000000 +0000
@@ -252,7 +252,7 @@ void *sbus_alloc_consistent(struct sbus_
}

order = get_order(len_total);
- if ((va = __get_free_pages(GFP_KERNEL, order)) == 0)
+ if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
goto err_nopages;

if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
--- 2.6.15-rc1-mm2/arch/sparc64/kernel/sbus.c 2005-11-12 09:00:36.000000000 +0000
+++ linux/arch/sparc64/kernel/sbus.c 2005-11-19 19:12:53.000000000 +0000
@@ -327,7 +327,7 @@ void *sbus_alloc_consistent(struct sbus_
order = get_order(size);
if (order >= 10)
return NULL;
- first_page = __get_free_pages(GFP_KERNEL, order);
+ first_page = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
if (first_page == 0UL)
return NULL;
memset((char *)first_page, 0, PAGE_SIZE << order);