Re: Usage of bootmem interface

From: Martin Mares (mj@suse.cz)
Date: Tue Jan 18 2000 - 04:55:21 EST


Hi Paul,

> Does anyone know if you have to call free_bootmem() for mem
> obtained via alloc_bootmem() or does the kernel's call to
> free_all_bootmem() do this for you? I noted that something
> simple like:
>
> bmem_test() {
> p=alloc_bootmem(SIZE);
> free_bootmem(p, SIZE)
> }
> __setup(test, bmem_test);
>
> even fails to work. I ask because I was trying to use the bootmem
> interface (to temporarily store the ether= info supplied at boot until
> the dev layer is ready to use it) and everything works fine until I
> try to free_bootmem() which triggers a BUG() in bootmem.c at 102.
> Line 102 of bootmem.c is in free_bootmem_core:
>
> if (end > bdata->node_low_pfn)
> BUG();

   If you allocate bootmem and you want to have it freed, you have to call
free_bootmem(), but before the bootmem area gets "frozen" which is before
kmalloc gets initialized.

> Unfortunately there arent (m)any other users of the bootmem stuff that
> I can use to compare to/learn from.

   For a (I hope fairly good) example of how to use bootmem in network
drivers, look at the recent ARCnet driver in drivers/net/arcnet/com90xx.c.

                                Have a nice fortnight

-- 
Martin `MJ' Mares <mj@ucw.cz> <mj@suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
"There really exists a Microsoft product that doesn't suck -- unfortunately, it's a vacuum cleaner."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:17 EST