Subject: Re: segmap alloc failed
To: Michael L. Hitch <mhitch@lightning.oscs.montana.edu>
From: Greg Wohletz <greg@duke.CS.UNLV.EDU>
List: port-pmax
Date: 07/18/1997 15:03:32
>On Jul 14, 12:43pm, Greg Wohletz wrote:
>> 
>> I have a Decstation 5000/200 running 1.2G (Jun 23) acting as a news server.
>> Every few days the system panics:
>> 
>> Jun 26 02:36:30 lazy /netbsd: panic: pmap_enter: segmap alloc failed
>> Jun 28 02:35:51 lazy /netbsd: panic: pmap_enter: segmap alloc failed
>> Jun 29 23:33:45 lazy /netbsd: panic: pmap_enter: segmap alloc failed
>> Jul  4 02:10:18 lazy /netbsd: panic: vm_fork: no more kernel virtual memory
>> Jul  8 17:15:46 lazy /netbsd: panic: pmap_enter: segmap alloc failed
>> Jul  9 02:49:36 lazy /netbsd: panic: pmap_enter: segmap alloc failed
>> 
>> Looking at sys/arch/mips/mips/pmap.c I find:
>> 
>>         if (!(pte = pmap_segmap(pmap, va))) {
>>                 mem = vm_page_alloc1();
>>                 if (mem == NULL)                /* XXX - fix this! */
>>                         panic("pmap_enter: segmap alloc failed");
>> 
>> Does someone know what this is about? Is there some config parameter
>> that I can tweak to avoid this? NKMEMCLUSTERS maybe?
>
>  It means that there wasn't any memory available when trying to allocate
>a page for a process's page tables.  I do not know of any configuration
>parameter when can be tweaked that would have any affect on this.
>
>  You might try the following patch, which will cause the current process
>to wait for available memory.  It's possible that there could be a deadlock
>situation, and there is also a possibility that you could get a crash later
>at another spot in pmap.c (where there currently is no check for a memory
>allocation failure).

I can try this patch, but I'm still curious as to what type of events can
cause this memory shortfall to occur.  The system doesn't do anything other
than run innd.  Innd is typically consumes about 20meg of vm space, the
system has 48meg of ram.  he panic's aren't happening at a time associated
with any particular cron even (like expire).  Typically when the system is
running vmstat reports around 20meg free ram, It rarely has to do any paging.


							--Greg
>
>Michael
>
>*** /c/src/sys/arch/mips/mips/pmap.c	Sun Jun 22 05:38:23 1997
>--- sys/arch/mips/mips/pmap.c	Wed Jul  9 13:46:42 1997
>***************
>*** 370,378 ****
>  		register struct segtab *stp;
>  		vm_page_t mem;
>  
>! 		mem = vm_page_alloc1();
>! 		if (mem == NULL)		/* XXX - fix this! */
>! 			panic("pmap_pinit: segtab alloc failed");
>  		pmap_zero_page(VM_PAGE_TO_PHYS(mem));
>  		pmap->pm_segtab = stp = (struct segtab *)
>  			MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem));
>--- 370,382 ----
>  		register struct segtab *stp;
>  		vm_page_t mem;
>  
>! 		do {
>! 			mem = vm_page_alloc1();
>! 			if (mem == NULL) {
>! 				VM_WAIT;	/* XXX What else can we do */
>! 			}			/* XXX Deadlock situations? */
>! 		} while (mem == NULL);
>! 
>  		pmap_zero_page(VM_PAGE_TO_PHYS(mem));
>  		pmap->pm_segtab = stp = (struct segtab *)
>  			MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem));
>***************
>*** 1025,1033 ****
>  	}
>  
>  	if (!(pte = pmap_segmap(pmap, va))) {
>! 		mem = vm_page_alloc1();
>! 		if (mem == NULL)		/* XXX - fix this! */
>! 			panic("pmap_enter: segmap alloc failed");
>  		pmap_zero_page(VM_PAGE_TO_PHYS(mem));
>  		pmap_segmap(pmap, va) = pte = (pt_entry_t *)
>  			MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem));
>--- 1034,1046 ----
>  	}
>  
>  	if (!(pte = pmap_segmap(pmap, va))) {
>! 		do {
>! 			mem = vm_page_alloc1();
>! 			if (mem == NULL) {
>! 				VM_WAIT;	/* XXX What else can we do */
>! 			}			/* XXX Deadlock situations? */
>! 		} while (mem == NULL);
>! 
>  		pmap_zero_page(VM_PAGE_TO_PHYS(mem));
>  		pmap_segmap(pmap, va) = pte = (pt_entry_t *)
>  			MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem));
>
>-- 
>Michael L. Hitch			mhitch@montana.edu
>Computer Consultant
>Information Technology Center
>Montana State University	Bozeman, MT	USA