Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Sep 2002 11:45:10 +1000
From:      Gregory Bond <gnb@itga.com.au>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Problems with FreeBSD - causing zalloc to return 0 ?! 
Message-ID:  <200209020145.LAA18441@lightning.itga.com.au>
In-Reply-To: Your message of Sat, 31 Aug 2002 19:26:51 -0700.

next in thread | raw e-mail | index | archive | help
>     If kernel_vm_end reaches 0xFFC00000 (or somewhere very close to
>     that), then you have run out of KVM.

So how about a warning message when pmap_growkernel() sets it to something near
this?

[I'm no kernel hacker, but afaict printf() is legal at splhigh().  And I don't 
really know the sort of quantum that is passed to pmap_growkernel() so I'm not 
sure if 16Mb is too big or too small...]

BTW: "sysctl vm.kvm_free" will show the number of bytes of free KVM so might 
be a better trick than gdb in the monitoring script.

--- sys/i386/i386/pmap.c        Fri Mar 15 13:52:54 2002
+++ sys/i386/i386/pmap.c.warn   Mon Sep  2 11:34:45 2002
@@ -1468,6 +1468,15 @@
                }
                *pmap_pde(kernel_pmap, kernel_vm_end) = newpdir;
                kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
+
+               /*
+                * Running kernel_vm_end to VM_MAX_KERNEL_ADDRESS is known to 
+                * be fatal in confusing ways, so give a bit of a hint when 
+                * we get near it so the crashes are less mysterious!
+                */
+#define VM_KERN_WARNLEVEL 0x1000000
+               if (VM_MAX_KERNEL_ADDRESS - kernel_vm_end < VM_KERN_WARNLEVEL)
+                       printf("warning: kernel VM space (0x%x) almost exhausted!", kernel_vm_end); 
        }
        splx(s);
 }



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209020145.LAA18441>