NetBSD Problem Report #11636

Received: (qmail 21130 invoked from network); 5 Dec 2000 15:05:04 -0000
Message-Id: <200012051505.eB5F5as00272@zeus.paradoxon.org>
Date: Tue, 5 Dec 2000 16:05:36 +0100 (CET)
From: lars@heidieker.de
Reply-To: lars@heidieker.de
To: gnats-bugs@gnats.netbsd.org
Subject: ubc vnode counter leak fix
X-Send-Pr-Version: 3.95

>Number:         11636
>Category:       kern
>Synopsis:       counter of vnode cache pages can grow too high
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    chs
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 05 15:06:00 +0000 2000
>Closed-Date:    Wed Dec 06 03:52:06 +0000 2000
>Last-Modified:  Wed Dec 06 03:52:06 +0000 2000
>Originator:     Lars Heidieker
>Release:        NetBSD-current 5th of December 2000
>Organization:

>Environment:

System: NetBSD zeus 1.5L NetBSD 1.5L (zeus) #3: Tue Dec 5 15:46:39 CET 2000 root@zeus:/usr/src/sys/arch/i386/compile/zeus i386
Architecture: i386
Machine: i386
>Description:
	Within the routine uvn_findpage there is an bug that will show up
under high memory loads. It is possible for uvm_pagealloc to return NULL
but the counter (uvmexp.vnodepages) will be bumped anyway -- possibly more
than once for a pageframe.
>How-To-Repeat:
	Just stress the memory subsystem and look at the vnode cache page
counter. You will end up with more anonymous memory mappings that are
resident plus vnode cache than you have physikal memory wich is impossible.
Another indicator is: After reboot you might get the vnode cache down to
about 100kb after some time you won't get it bellow a few megs and so on
(This might explain a crash someone has reported). This will prevent the
counter from being bumped to often.
>Fix:

	Insertation of a little if statement:
                /* nope?   allocate one now */
                if (pg == NULL) {
                        if (flags & UFP_NOALLOC) {
                                UVMHIST_LOG(ubchist, "noalloc", 0,0,0,0);
                                return 0;
                        }
                        if (uvmexp.vnodepages > 
                            (uvmexp.active + uvmexp.inactive + uvmexp.wired +
                             uvmexp.free) * 7 / 8) {
                                pg = NULL;
                        } else {
                                pg = uvm_pagealloc(uobj, offset, NULL, 0);
 Thats the one -------->        if (pg != NULL)
                                        uvmexp.vnodepages++;
                        }
                        if (pg == NULL) {
                                if (flags & UFP_NOWAIT) {
                                        UVMHIST_LOG(ubchist, "nowait",0,0,0,0);
                                        return 0;
                                }
                                simple_unlock(&uobj->vmobjlock);
                                uvm_wait("uvn_fp1");
                                simple_lock(&uobj->vmobjlock);
                                continue;
                        }
                        UVMHIST_LOG(ubchist, "alloced",0,0,0,0);
                        break;
                } else if (flags & UFP_NOCACHE) {
                        UVMHIST_LOG(ubchist, "nocache",0,0,0,0);
                        return 0;
                }

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: chs 
State-Changed-When: Tue Dec 5 19:50:49 PST 2000 
State-Changed-Why:  
change applied, thanks! 


Responsible-Changed-From-To: kern-bug-people->chs 
Responsible-Changed-By: chs 
Responsible-Changed-When: Tue Dec 5 19:50:49 PST 2000 
Responsible-Changed-Why:  
my fault. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.