Re: DMA memory, split_page, BUG_ON(PageCompound()), sound

From: Nick Piggin
Date: Mon Jul 10 2006 - 03:09:05 EST


Marc Singer wrote:
On Sun, Jul 09, 2006 at 01:26:06PM +1000, Nick Piggin wrote:

Marc Singer wrote:

I'm investigating why I am triggering a BUG_ON in split_page() when I
use the sound subsystems dma memory allocation aide.

The crux of the problem appears to be that snd_malloc_dev_pages()
passes __GFP_COMP into dma_alloc_coherent(). On the ARM and several
other architectures, the dma allocation code calls split_page () with
pages allocated with this flag which, in turn, triggers the BUG_ON()
check for the CompoundPage flag.

So, the questions are these: Who is doing the wrong thing? Should the
snd_malloc_dev_pages() call drop the __GFP_COMP flag? Should
split_page() allow the page to be compound? Should __GFP_COMP be 0 on
ARM and other architectures that don't support compound pages?

I personally never liked the explicit __GFP_COMP going in everywhere,
and would have much preferred a GFP_USERMAP, which the architecture /
allocator could satisfy as they liked.


Thus, the __GFP_COMP bit would be part of another flags such that it
is set on x86 (or any other architecture that supports it) and clear
on those that don't.

I guess you could do it a number of ways. Maybe having GFP_USERMAP
set __GFP_USERMAP|__GFP_COMP, and the arm dma memory allocator can
strip the __GFP_COMP.

If you get an explicit __GFP_COMP passed down, the allocator doesn't
know whether that was because they want a user mappable area, or
really want a compound page (in which case, stripping __GFP_COMP is
the wrong thing to do).



As a hack, you can make arm's dma_alloc_coherent() drop __GFP_COMP,
which should work.


There are many architectures that have this problem, so I suspect that
such a patch would be unappreciated.


Hacks usually are ;) It would get you working though.

If you want to write a patch that would be appreciated, that would be
appreciated.

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/