Bug #911

Updated by robgar 5 months ago


I just booted with hw.physmem=64m and got a panic when trying to load a module:

panic: kld: malloc limit exceeded

(kgdb) bt

#0 dumpsys () at thread.h:83

#1 0xc018450c in boot (howto=256) at /usr/build/src/sys/kern/kern_shutdown.c:375

#2 0xc0184661 in panic (fmt=Variable "fmt" is not available.

) at /usr/build/src/sys/kern/kern_shutdown.c:800

#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

#5 0xc016a773 in link_elf_load_module (filename=0xc641b000 "./nvidia.ko", result=0xc83efc7c)

at /usr/build/src/sys/kern/link_elf.c:604

#6 0xc01684e0 in linker_load_file (filename=0xc641b000 "./nvidia.ko", result=0xc83efca8)

at /usr/build/src/sys/kern/kern_linker.c:272

#7 0xc016871c in sys_kldload (uap=0xc83efcf0) at /usr/build/src/sys/kern/kern_linker.c:724

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?