From: Matthew Wilcox <matthew@wil.cx>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] kmalloc(HIGHUSER) crashes
Date: Thu, 28 Dec 2000 14:58:01 +0000 [thread overview]
Message-ID: <20001228145801.C19693@parcelfarce.linux.theplanet.co.uk> (raw)
doh, i'm a moron.
------ This is a copy of the message ------
Date: Thu, 28 Dec 2000 14:51:25 +0000
From: Matthew Wilcox <matthew@wil.cx>
To: linux-kernel@vger.rutgers.edu
Cc: torvalds@transmeta.com
Subject: [PATCH] kmalloc(HIGHUSER) crashes
The slab cache accepts the __GFP_HIGHMEM flag, but it will then die
horribly, tracing it through:
<linux/slab.h>
#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHMEM)
slab.c:kmem_cache_grow()
if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
BUG();
(...)
slab.c:kmem_getpages()
addr = (void*) __get_free_pages(flags, cachep->gfporder);
__get_free_pages calls page_address() on the allocated pages, but:
/*
* Permanent address of a page. Obviously must never be
* called on a highmem page.
*/
#define page_address(page) ((page)->virtual)
so I think we should apply the patch at the bottom of this email.
Ideally, I think slab.c should call alloc_pages and manage them directly
-- it calls virt_to_page often enough that it should become more intimate
with the linux struct page *. But I don't think we should allow HIGHMEM
kmallocs anyway; we'd run out of kmap space too readily.
Index: include/linux/slab.h
===================================================================
RCS file: /var/cvs/linux/include/linux/slab.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 include/linux/slab.h
--- include/linux/slab.h 2000/10/31 19:18:05 1.1.1.1
+++ include/linux/slab.h 2000/12/28 11:06:49
@@ -22,7 +22,7 @@ typedef struct kmem_cache_s kmem_cache_t
#define SLAB_NFS GFP_NFS
#define SLAB_DMA GFP_DMA
-#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHMEM)
+#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO)
#define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */
/* flags to pass to kmem_cache_create().
--
Revolutions do not require corporate support.
----- End forwarded message -----
--
Revolutions do not require corporate support.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
reply other threads:[~2000-12-28 15:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20001228145801.C19693@parcelfarce.linux.theplanet.co.uk \
--to=matthew@wil.cx \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).