LKML Archive on
help / color / mirror / Atom feed
From: "Martyn Welch" <>
To: <>
Subject: alloc_bootmem - Kernel panic
Date: Wed, 7 Feb 2007 13:41:02 -0000	[thread overview]
Message-ID: <F38DEABE0E171746B133C1ABBD142D97063253D0@radmail.Radstone.Local> (raw)

Hi Everyone,

First I'd like to appologise if my query is glaringly obvious. I'm
reasonable new to this, but every that I have read (including the Linux
Device Drivers book) seems to suggest that what I am doing should

I am attempting to allocate a large buffer for DMA transfers in a driver
I am working on. I understand that the kernel normally will not allocate
block of coherent memory larger than 128KB, the suggested solution seems
to be to compile the driver into the kernel and allocate memory at boot
using alloc_bootmem. When attempting this I receive a kernel panic:


Loading driver.
bootmem alloc of 4096 bytes failed!
Kernel panic - not syncing: Out of memory

This is using:

kernel version 2.6.20
gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)

The config is based on the default i386 config + one extra option to
cause my driver to be compiled in.

The offending code is listed below,

Thank you for any help in advance,



#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/bootmem.h>

void *buffer;

static int __init universeII_init(void)
        printk(KERN_INFO "Loading driver.\n");

        buffer = alloc_bootmem(PAGE_SIZE);

        return 0;


static void __exit universeII_exit(void)
        if (buffer != NULL) {
                free_bootmem((unsigned long)buffer, PAGE_SIZE);
        printk(KERN_INFO "Driver removed.\n");

MODULE_DESCRIPTION("alloc_bootmem_x Test");
MODULE_AUTHOR("Martyn Welch <>");

/** Register initilisation function */
/** Register cleanup function */

This e-mail has been scanned for all viruses by Star.The service is powered by MessageLabs. 

             reply	other threads:[~2007-02-07 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-07 13:41 Martyn Welch [this message]
2007-02-07 16:47 Martyn Welch
2007-02-07 18:24 ` Asgard

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F38DEABE0E171746B133C1ABBD142D97063253D0@radmail.Radstone.Local \ \ \
    --subject='Re: alloc_bootmem - Kernel panic' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).