aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-11-22 00:32:22 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-22 12:13:43 -0500
commitf3d48f0373c14a6203202f7b1dfc7b0d8aaf6ed2 (patch)
treee09198efae7c68b9b4799b0f85d67951cc33bb54 /sound
parent0b0db14c536debd92328819fe6c51a49717e8440 (diff)
[PATCH] unpaged: fix sound Bad page states
Earlier I unifdefed PageCompound, so that snd_pcm_mmap_control_nopage and others can give out a 0-order component of a higher-order page, which won't be mistakenly freed when zap_pte_range unmaps it. But many Bad page states reported a PG_reserved was freed after all: I had missed that we need to say __GFP_COMP to get compound page behaviour. Some of these higher-order pages are allocated by snd_malloc_pages, some by snd_malloc_dev_pages; or if SBUS, by sbus_alloc_consistent - but that has no gfp arg, so add __GFP_COMP into its sparc32/64 implementations. I'm still rather puzzled that DRM seems not to need a similar change. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/memalloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 129abab5ce98..e4b8959dd4bb 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -197,6 +197,7 @@ void *snd_malloc_pages(size_t size, gfp_t gfp_flags)
197 197
198 snd_assert(size > 0, return NULL); 198 snd_assert(size > 0, return NULL);
199 snd_assert(gfp_flags != 0, return NULL); 199 snd_assert(gfp_flags != 0, return NULL);
200 gfp_flags |= __GFP_COMP; /* compound page lets parts be mapped */
200 pg = get_order(size); 201 pg = get_order(size);
201 if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) { 202 if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) {
202 mark_pages(virt_to_page(res), pg); 203 mark_pages(virt_to_page(res), pg);
@@ -241,6 +242,7 @@ static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *d
241 snd_assert(dma != NULL, return NULL); 242 snd_assert(dma != NULL, return NULL);
242 pg = get_order(size); 243 pg = get_order(size);
243 gfp_flags = GFP_KERNEL 244 gfp_flags = GFP_KERNEL
245 | __GFP_COMP /* compound page lets parts be mapped */
244 | __GFP_NORETRY /* don't trigger OOM-killer */ 246 | __GFP_NORETRY /* don't trigger OOM-killer */
245 | __GFP_NOWARN; /* no stack trace print - this call is non-critical */ 247 | __GFP_NOWARN; /* no stack trace print - this call is non-critical */
246 res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); 248 res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags);