* kmalloc() of 4MB causes "kernel BUG at slab.c:1542!"
@ 2001-01-17 19:54 Rick Richardson
2001-01-17 20:17 ` Brian Pomerantz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rick Richardson @ 2001-01-17 19:54 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]
[please cc me on any responses]
Environment: 2.4.0 released, Pentium III with 256MB's of RAM.
Problem: kmalloc() of 4M causes kernel message "kernel BUG at slab.c:1542"
Here is the dmesg output:
kernel BUG at slab.c:1542!
invalid operand: 0000
CPU: 0
EIP: 0010:[<c0129b84>]
EFLAGS: 00010282
eax: 0000001b ebx: d2922000 ecx: cdf6c000 edx: 00000000
esi: 00000007 edi: 00000000 ebp: 0806f124 esp: cb1bdef4
ds: 0018 es: 0018 ss: 0018
Process insmod (pid: 24167, stackpage=cb1bd000)
Stack: c02148eb c021498b 00000606 00000286 00000001 c02a75ec 00000029 d2922000
00000000 d2922083 01000000 00000007 d29221c0 01000000 c0116c65 00000000
cc8a6000 0000020c cc8a7000 00000060 ffffffea 00000003 c2be5420 00000060
Call Trace: [<d2922000>] [<d2922083>] [<d29221c0>] [<c0116c65>] [<d2920000>] [<d2922060>] [<c0109057>]
Code: 0f 0b 83 c4 0c 31 c0 83 c4 10 5b 5e c3 eb 0d 90 90 90 90 90
Repeat by:
Compile simple driver attached.
$ insmod test.o Amt=4096
--
Rick Richardson rick@remotepoint.com http://home.mn.rr.com/richardsons/
Twins Cities traffic animations are at http://members.nbci.com/tctraffic/#1
Most Minnesotans think Global Warming is a good thing.
[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 1103 bytes --]
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/config.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/errno.h>
#include <linux/in.h>
#include <linux/mm.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
static size_t Amt = 1;
MODULE_PARM(Amt, "l");
MODULE_PARM_DESC(Amt, "Pages of memory to allocate");
static void *mem;
static int __init
init(void)
{
/* Announce this module has been loaded. */
printk(KERN_INFO "test loading; allocate %d bytes\n", Amt*4096);
mem = kmalloc(Amt*4096, GFP_KERNEL);
if (!mem) return (-ENOMEM);
printk(KERN_INFO "test loaded\n");
return 0;
}
static void __exit
fini(void)
{
printk(KERN_INFO "test unloading\n");
kfree(mem);
}
module_init(init);
module_exit(fini);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kmalloc() of 4MB causes "kernel BUG at slab.c:1542!"
2001-01-17 19:54 kmalloc() of 4MB causes "kernel BUG at slab.c:1542!" Rick Richardson
@ 2001-01-17 20:17 ` Brian Pomerantz
2001-01-17 20:39 ` Timur Tabi
2001-01-18 5:11 ` Hans Grobler
2 siblings, 0 replies; 4+ messages in thread
From: Brian Pomerantz @ 2001-01-17 20:17 UTC (permalink / raw)
To: Rick Richardson; +Cc: linux-kernel
On Wed, Jan 17, 2001 at 01:54:20PM -0600, Rick Richardson wrote:
>
> [please cc me on any responses]
>
> Environment: 2.4.0 released, Pentium III with 256MB's of RAM.
> Problem: kmalloc() of 4M causes kernel message "kernel BUG at slab.c:1542"
>
The most you can kmalloc() is 128KB unless this has changed in the 2.4
kernel which I doubt. If you want a region of memory that large, use
vmalloc(). Of course, this doesn't guarantee a contiguous region.
BAPper
-
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kmalloc() of 4MB causes "kernel BUG at slab.c:1542!"
2001-01-17 19:54 kmalloc() of 4MB causes "kernel BUG at slab.c:1542!" Rick Richardson
2001-01-17 20:17 ` Brian Pomerantz
@ 2001-01-17 20:39 ` Timur Tabi
2001-01-18 5:11 ` Hans Grobler
2 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2001-01-17 20:39 UTC (permalink / raw)
To: linux-kernel
** Reply to message from Brian Pomerantz <bapper@piratehaven.org> on Wed, 17
Jan 2001 12:17:19 -0800
> The most you can kmalloc() is 128KB unless this has changed in the 2.4
> kernel which I doubt. If you want a region of memory that large, use
> vmalloc(). Of course, this doesn't guarantee a contiguous region.
Couldn't you also use get_free_pages (commonly abbreviated as "gfp")? You can
alloc up to 2MB chunks on an x86 I think.
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing list only. Don't send another copy to me.
-
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kmalloc() of 4MB causes "kernel BUG at slab.c:1542!"
2001-01-17 19:54 kmalloc() of 4MB causes "kernel BUG at slab.c:1542!" Rick Richardson
2001-01-17 20:17 ` Brian Pomerantz
2001-01-17 20:39 ` Timur Tabi
@ 2001-01-18 5:11 ` Hans Grobler
2 siblings, 0 replies; 4+ messages in thread
From: Hans Grobler @ 2001-01-18 5:11 UTC (permalink / raw)
To: Rick Richardson; +Cc: linux-kernel
On Wed, 17 Jan 2001, Rick Richardson wrote:
> Problem: kmalloc() of 4M causes kernel message "kernel BUG at slab.c:1542"
This BUG() has been been removed in the later -ac patches as it was meant
to be a temporary debugging help during the -test3 slab.c changes. This
does not however remove the constraint that kmalloc can only allocate a
maximum of 128KB. How you solve this will depend what you want to use the
memory for.
-- Hans
-
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-01-18 5:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-17 19:54 kmalloc() of 4MB causes "kernel BUG at slab.c:1542!" Rick Richardson
2001-01-17 20:17 ` Brian Pomerantz
2001-01-17 20:39 ` Timur Tabi
2001-01-18 5:11 ` Hans Grobler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox