panic on kldload

Simon 'corecode' Schubert corecode at
Thu Jan 10 14:58:53 PST 2008

Matthew Dillon wrote:
:I just booted with hw.physmem=64m and got a panic when trying to load a module:
:panic: kld: malloc limit exceeded
:#3  0xc0182129 in kmalloc (size=78, type=0xc02f5600, flags=2)
:    at /usr/build/src/sys/kern/kern_slaballoc.c:445
:#4  0xc01678b4 in linker_make_file (pathname=0xc641b000 "./nvidia.ko", priv=0xc63ea028, 
:    ops=0xc02f5bc8) at /usr/build/src/sys/kern/kern_linker.c:369
:the problem seems to be that M_LINKER already used 10% of all memory (allegedly).  In this case kmalloc() simply panics if passing M_WAITOK without M_NULLOK.  This is quite unfortunate.  Shouldn't we try to stay alive and print a warning and block, hoping that the problem will resolve itself?
:  simon

    That's an administrative limit, it sounds like the solution is to simply
    assign a reasonable minimum to it.
    Well, what's the malloc limit when you have 64MB of ram?  From gdb
    do 'print M_LINKER'.  And... is the amount of memory it thinks it is
    using roughly similar to the amount of memory the loaded modules ought
    to be taking up?
The limit is ~6MB, the linker consumes 8MB.  I just realized that we 
have in struct malloc_type:

        __uint16_t ks_limblocks; /* number of times blocked for hitting 
limit */

But we're never using this.


More information about the Bugs mailing list