Subject: kern/34667: NTFS uses to much kernel memory
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Simon Burge <simonb@NetBSD.org>
List: netbsd-bugs
Date: 09/30/2006 04:30:00
>Number:         34667
>Category:       kern
>Synopsis:       NTFS uses to much kernel memory
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 30 04:30:00 +0000 2006
>Originator:     Simon Burge
>Release:        NetBSD 4.99.2 from September 24.
>Organization:
>Environment:
NetBSD euclid.thistledown.com.au 4.99.2 NetBSD 4.99.2 (EUCLID2) #14: Sun Sep 24 13:53:40 EST 2006  simonb@euclid.thistledown.com.au:/home/netbsd/src/sys/arch/i386/compile/EUCLID2 i386
Architecture: i386
Machine: i386
>Description:

        Every couple of nights when /etc/daily runs it's find, I get a

		panic: malloc: out of space in kmem_map

        panic.  A "vmstat -m" on the kernel core shows that NTFS is
        using about 119MB of the 128MB allocated for kmem_map:

Memory statistics by type                           Type  Kern
         Type  InUse MemUse HighUse  Limit  Requests Limit Limit Size(s)
     NTFS vrun  7056   131K    131K 78644K      7060    0     0  16,32,64,128,256,512
      NTFS dir 12496 49984K  49984K 78644K     12496    0     0  4096
 NTFS res data 44690  7836K   7836K 78644K     44695    0     0  16,64,128,256,512,1024,131072
    NTFS vattr 48217 24109K  24109K 78644K     48224    0     0  512
    NTFS fnode 81032 20258K  20258K 78644K     81034    0     0  256
   NTFS ntnode 81032 20258K  20258K 78644K     81034    0     0  256

>How-To-Repeat:

        Mount a NTFS filesystem with about 127000 files and run find(1).
        Note that the find from /etc/daily doesn't cause the kernel to
        run out of memory every night, seems to be about every third
        night...

>Fix:

        Not sure.  Converting NTFS to use pools should at least relieve
        some pressure on kmem_map.  The "NTFS dir" allocations (the
        largest memory user) though are not fixed size, so won't convert
        to pools easily.