From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Takashi Iwai <tiwai@suse.de>,
Russell King <rmk+lkml@arm.linux.org.uk>,
William Irwin <wli@holomorphy.com>,
"David S. Miller" <davem@davemloft.net>,
Linus Torvalds <torvalds@osdl.org>,
Nick Piggin <nickpiggin@yahoo.com.au>,
Dave Airlie <airlied@gmail.com>,
linux-kernel@vger.kernel.org, alsa-devel@lists.sourceforge.net
Subject: [PATCH 12/11] unpaged: fix sound Bad page states
Date: Mon, 21 Nov 2005 18:12:38 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.61.0511211801070.17464@goblin.wat.veritas.com> (raw)
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>
---
arch/sparc/kernel/ioport.c | 2 +-
arch/sparc64/kernel/sbus.c | 2 +-
sound/core/memalloc.c | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
--- 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);
--- 2.6.15-rc1-mm2/sound/core/memalloc.c 2005-11-12 09:01:28.000000000 +0000
+++ linux/sound/core/memalloc.c 2005-11-19 19:03:32.000000000 +0000
@@ -197,6 +197,7 @@ void *snd_malloc_pages(size_t size, gfp_
snd_assert(size > 0, return NULL);
snd_assert(gfp_flags != 0, return NULL);
+ gfp_flags |= __GFP_COMP; /* compound page lets parts be mapped */
pg = get_order(size);
if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL) {
mark_pages(virt_to_page(res), pg);
@@ -241,6 +242,7 @@ static void *snd_malloc_dev_pages(struct
snd_assert(dma != NULL, return NULL);
pg = get_order(size);
gfp_flags = GFP_KERNEL
+ | __GFP_COMP /* compound page lets parts be mapped */
| __GFP_NORETRY /* don't trigger OOM-killer */
| __GFP_NOWARN; /* no stack trace print - this call is non-critical */
res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags);
next reply other threads:[~2005-11-21 19:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 18:12 Hugh Dickins [this message]
2005-11-21 20:41 ` Andrew Morton
2005-11-21 22:40 ` Hugh Dickins
2005-11-21 21:57 ` William Lee Irwin III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0511211801070.17464@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=airlied@gmail.com \
--cc=akpm@osdl.org \
--cc=alsa-devel@lists.sourceforge.net \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=tiwai@suse.de \
--cc=torvalds@osdl.org \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®