Hello, My colleague p3k3y and I first asked about this on #debian-kernel. waldi suggested that we write a script to reproduce the problem and post it here, so here we are. First, a description of the symptoms. Our setup consists of a tmpfs mount limited to 2GB with 5 million inodes (the script provides a sample mount command). In this directory we have a tree that consists of many hundreds of thousand small to smallish files and thousands more symlinks. General load is for many reads per second with a lot of concurrent updates too: files being replaced, new files/directories being created and files being deleted. However, our script reproduces the problem without any of the ongoing access being emulated, so I don't think the ongoing access are causing the problem. The sympom is that the tmpfs mount takes up a *lot* more memory than df -h says it is: in one case on one of our servers, df -h reported a little over 600MB used, but unmounting the drive returned some 6GB back to the system. A good indicator of the problem is that there is very little memory available for buffers or cache: nicely visualised by the memory bar in htop being completely green. waldi suggested a slab leak, and asked for output from /proc/meminfo and /proc/slabinfo on an affected machine, which I have attached separately. He then asked for a script to reproduce the problem so it can be easily debugged. The servers are all running: Linux <hostname> 2.6.18-5-amd64 #1 SMP Tue Oct 2 20:37:02 UTC 2007 x86_64 GNU/Linux Apart from one which is the same but 32-bit. I have been able to reproduce this on my personal machine: both running 2.6.23, one 32-bit and one amd64. I have also tried the SLUB allocator, but the problem persists (although we haven't tried that on the production servers). The reproduction script should be self-explanatory: please read the comment at the top for how it should be used. It takes a little while to run, too. Please include my email address in replies as I am not subscribed to this list. Thank you for reading, I appreciate any help that can be given. -- Russell Brown -- Ebuyer (UK) Ltd. - Registered in England and Wales No. 3941136 Registered Office: Ferry Road, Howden, East Yorkshire, DN14 7UW
Attachment:
example_tmpfs_data_generator.sh
Description: application/shellscript
$ cat /proc/meminfo MemTotal: 4051532 kB MemFree: 52584 kB Buffers: 20856 kB Cached: 303364 kB SwapCached: 36972 kB Active: 278172 kB Inactive: 220368 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 4051532 kB LowFree: 52584 kB SwapTotal: 3903784 kB SwapFree: 3481004 kB Dirty: 2592 kB Writeback: 0 kB AnonPages: 137216 kB Mapped: 15540 kB Slab: 3469896 kB PageTables: 11860 kB NFS_Unstable: 0 kB Bounce: 0 kB CommitLimit: 5929548 kB Committed_AS: 999480 kB VmallocTotal: 34359738367 kB VmallocUsed: 2168 kB VmallocChunk: 34359736131 kB
$ cat /proc/slabinfo slabinfo - version: 2.1 # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail> nfs_direct_cache 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 nfs_write_data 36 36 832 9 2 : tunables 54 27 8 : slabdata 4 4 0 nfs_read_data 32 35 768 5 1 : tunables 54 27 8 : slabdata 7 7 0 nfs_inode_cache 26977 27308 1000 4 1 : tunables 54 27 8 : slabdata 6821 6827 128 nfs_page 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 rpc_buffers 8 8 2048 2 1 : tunables 24 12 8 : slabdata 4 4 0 rpc_tasks 8 10 384 10 1 : tunables 54 27 8 : slabdata 1 1 0 rpc_inode_cache 8 8 832 4 1 : tunables 54 27 8 : slabdata 2 2 0 fib6_nodes 7 59 64 59 1 : tunables 120 60 8 : slabdata 1 1 0 ip6_dst_cache 7 12 320 12 1 : tunables 54 27 8 : slabdata 1 1 0 ndisc_cache 1 15 256 15 1 : tunables 120 60 8 : slabdata 1 1 0 RAWv6 11 12 896 4 1 : tunables 54 27 8 : slabdata 3 3 0 UDPv6 7 8 896 4 1 : tunables 54 27 8 : slabdata 2 2 0 tw_sock_TCPv6 100 140 192 20 1 : tunables 120 60 8 : slabdata 7 7 0 request_sock_TCPv6 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 TCPv6 35 40 1664 4 2 : tunables 24 12 8 : slabdata 10 10 0 ip_fib_alias 13 59 64 59 1 : tunables 120 60 8 : slabdata 1 1 0 ip_fib_hash 13 59 64 59 1 : tunables 120 60 8 : slabdata 1 1 0 jbd_1k 0 0 1024 4 1 : tunables 54 27 8 : slabdata 0 0 0 dm-snapshot-in 128 136 112 34 1 : tunables 120 60 8 : slabdata 4 4 0 dm-snapshot-ex 0 0 32 112 1 : tunables 120 60 8 : slabdata 0 0 0 dm_tio 0 0 24 144 1 : tunables 120 60 8 : slabdata 0 0 0 dm_io 0 0 40 92 1 : tunables 120 60 8 : slabdata 0 0 0 jbd_4k 8 8 4096 1 1 : tunables 24 12 8 : slabdata 8 8 0 ext3_inode_cache 3846 6690 784 5 1 : tunables 54 27 8 : slabdata 1338 1338 0 ext3_xattr 0 0 88 44 1 : tunables 120 60 8 : slabdata 0 0 0 journal_handle 96 144 24 144 1 : tunables 120 60 8 : slabdata 1 1 0 journal_head 244 560 96 40 1 : tunables 120 60 8 : slabdata 14 14 0 revoke_table 14 202 16 202 1 : tunables 120 60 8 : slabdata 1 1 0 revoke_record 0 0 32 112 1 : tunables 120 60 8 : slabdata 0 0 0 scsi_cmd_cache 20 20 384 10 1 : tunables 54 27 8 : slabdata 2 2 0 sgpool-128 32 33 4096 1 1 : tunables 24 12 8 : slabdata 32 33 0 sgpool-64 32 32 2048 2 1 : tunables 24 12 8 : slabdata 16 16 0 sgpool-32 32 32 1024 4 1 : tunables 54 27 8 : slabdata 8 8 0 sgpool-16 36 40 512 8 1 : tunables 54 27 8 : slabdata 5 5 0 sgpool-8 60 60 256 15 1 : tunables 120 60 8 : slabdata 4 4 0 scsi_io_context 0 0 112 34 1 : tunables 120 60 8 : slabdata 0 0 0 uhci_urb_priv 2 67 56 67 1 : tunables 120 60 8 : slabdata 1 1 0 clip_arp_cache 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0 UNIX 81 99 704 11 2 : tunables 54 27 8 : slabdata 9 9 27 flow_cache 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 msi_cache 6 59 64 59 1 : tunables 120 60 8 : slabdata 1 1 0 cfq_ioc_pool 127 144 160 24 1 : tunables 120 60 8 : slabdata 6 6 0 cfq_pool 65 168 160 24 1 : tunables 120 60 8 : slabdata 7 7 0 crq_pool 96 96 80 48 1 : tunables 120 60 8 : slabdata 2 2 0 deadline_drq 0 0 80 48 1 : tunables 120 60 8 : slabdata 0 0 0 as_arq 0 0 96 40 1 : tunables 120 60 8 : slabdata 0 0 0 mqueue_inode_cache 1 4 896 4 1 : tunables 54 27 8 : slabdata 1 1 0 dnotify_cache 0 0 40 92 1 : tunables 120 60 8 : slabdata 0 0 0 dquot 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0 eventpoll_pwq 90 159 72 53 1 : tunables 120 60 8 : slabdata 3 3 0 eventpoll_epi 90 160 192 20 1 : tunables 120 60 8 : slabdata 8 8 0 inotify_event_cache 0 0 40 92 1 : tunables 120 60 8 : slabdata 0 0 0 inotify_watch_cache 1 53 72 53 1 : tunables 120 60 8 : slabdata 1 1 0 kioctx 0 0 320 12 1 : tunables 54 27 8 : slabdata 0 0 0 kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0 fasync_cache 0 0 24 144 1 : tunables 120 60 8 : slabdata 0 0 0 shmem_inode_cache 3375673 3375680 792 5 1 : tunables 54 27 8 : slabdata 675136 675136 0 posix_timers_cache 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 uid_cache 11 30 128 30 1 : tunables 120 60 8 : slabdata 1 1 0 ip_mrt_cache 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 tcp_bind_bucket 639 896 32 112 1 : tunables 120 60 8 : slabdata 8 8 30 inet_peer_cache 4 30 128 30 1 : tunables 120 60 8 : slabdata 1 1 0 secpath_cache 0 0 64 59 1 : tunables 120 60 8 : slabdata 0 0 0 xfrm_dst_cache 0 0 384 10 1 : tunables 54 27 8 : slabdata 0 0 0 ip_dst_cache 81 100 384 10 1 : tunables 54 27 8 : slabdata 10 10 0 arp_cache 17 30 256 15 1 : tunables 120 60 8 : slabdata 2 2 0 RAW 9 10 768 5 1 : tunables 54 27 8 : slabdata 2 2 0 UDP 16 25 768 5 1 : tunables 54 27 8 : slabdata 5 5 0 tw_sock_TCP 589 740 192 20 1 : tunables 120 60 8 : slabdata 37 37 7 request_sock_TCP 14 30 128 30 1 : tunables 120 60 8 : slabdata 1 1 0 TCP 39 45 1536 5 2 : tunables 24 12 8 : slabdata 9 9 12 blkdev_ioc 127 201 56 67 1 : tunables 120 60 8 : slabdata 3 3 0 blkdev_queue 26 30 1576 5 2 : tunables 24 12 8 : slabdata 6 6 0 blkdev_requests 70 70 272 14 1 : tunables 54 27 8 : slabdata 5 5 27 biovec-256 11 11 4096 1 1 : tunables 24 12 8 : slabdata 11 11 0 biovec-128 15 16 2048 2 1 : tunables 24 12 8 : slabdata 8 8 0 biovec-64 23 24 1024 4 1 : tunables 54 27 8 : slabdata 6 6 0 biovec-16 23 30 256 15 1 : tunables 120 60 8 : slabdata 2 2 0 biovec-4 26 59 64 59 1 : tunables 120 60 8 : slabdata 1 1 0 biovec-1 202 404 16 202 1 : tunables 120 60 8 : slabdata 2 2 84 bio 420 540 128 30 1 : tunables 120 60 8 : slabdata 18 18 24 sock_inode_cache 185 185 704 5 1 : tunables 54 27 8 : slabdata 37 37 0 skbuff_fclone_cache 70 70 512 7 1 : tunables 54 27 8 : slabdata 10 10 27 skbuff_head_cache 513 600 256 15 1 : tunables 120 60 8 : slabdata 40 40 30 file_lock_cache 44 44 176 22 1 : tunables 120 60 8 : slabdata 2 2 0 Acpi-Operand 546 649 64 59 1 : tunables 120 60 8 : slabdata 11 11 0 Acpi-ParseExt 0 0 64 59 1 : tunables 120 60 8 : slabdata 0 0 0 Acpi-Parse 0 0 40 92 1 : tunables 120 60 8 : slabdata 0 0 0 Acpi-State 0 0 80 48 1 : tunables 120 60 8 : slabdata 0 0 0 Acpi-Namespace 424 448 32 112 1 : tunables 120 60 8 : slabdata 4 4 0 proc_inode_cache 634 648 616 6 1 : tunables 54 27 8 : slabdata 108 108 13 sigqueue 48 48 160 24 1 : tunables 120 60 8 : slabdata 2 2 0 radix_tree_node 7265 8204 536 7 1 : tunables 54 27 8 : slabdata 1172 1172 0 bdev_cache 10 16 832 4 1 : tunables 54 27 8 : slabdata 4 4 0 sysfs_dir_cache 4048 4080 80 48 1 : tunables 120 60 8 : slabdata 85 85 0 mnt_cache 33 45 256 15 1 : tunables 120 60 8 : slabdata 3 3 0 inode_cache 886 980 584 7 1 : tunables 54 27 8 : slabdata 140 140 0 dentry_cache 3398831 3399347 208 19 1 : tunables 120 60 8 : slabdata 178913 178913 384 filp 1210 1425 256 15 1 : tunables 120 60 8 : slabdata 95 95 324 names_cache 17 17 4096 1 1 : tunables 24 12 8 : slabdata 17 17 0 key_jar 19 40 192 20 1 : tunables 120 60 8 : slabdata 2 2 0 idr_layer_cache 77 77 528 7 1 : tunables 54 27 8 : slabdata 11 11 0 buffer_head 13524 39840 96 40 1 : tunables 120 60 8 : slabdata 996 996 204 mm_struct 122 144 832 9 2 : tunables 54 27 8 : slabdata 16 16 0 vm_area_struct 15002 16236 176 22 1 : tunables 120 60 8 : slabdata 738 738 420 fs_cache 158 295 64 59 1 : tunables 120 60 8 : slabdata 5 5 0 files_cache 130 130 768 5 1 : tunables 54 27 8 : slabdata 26 26 0 signal_cache 165 187 704 11 2 : tunables 54 27 8 : slabdata 17 17 0 sighand_cache 146 156 2112 3 2 : tunables 24 12 8 : slabdata 50 52 0 task_struct 168 168 1840 2 1 : tunables 24 12 8 : slabdata 84 84 12 anon_vma 982 1584 24 144 1 : tunables 120 60 8 : slabdata 11 11 84 pid 188 295 64 59 1 : tunables 120 60 8 : slabdata 5 5 0 shared_policy_node 0 0 48 77 1 : tunables 120 60 8 : slabdata 0 0 0 numa_policy 37 144 24 144 1 : tunables 120 60 8 : slabdata 1 1 0 size-131072(DMA) 0 0 131072 1 32 : tunables 8 4 0 : slabdata 0 0 0 size-131072 0 0 131072 1 32 : tunables 8 4 0 : slabdata 0 0 0 size-65536(DMA) 0 0 65536 1 16 : tunables 8 4 0 : slabdata 0 0 0 size-65536 1 1 65536 1 16 : tunables 8 4 0 : slabdata 1 1 0 size-32768(DMA) 0 0 32768 1 8 : tunables 8 4 0 : slabdata 0 0 0 size-32768 9 9 32768 1 8 : tunables 8 4 0 : slabdata 9 9 0 size-16384(DMA) 0 0 16384 1 4 : tunables 8 4 0 : slabdata 0 0 0 size-16384 6 6 16384 1 4 : tunables 8 4 0 : slabdata 6 6 0 size-8192(DMA) 0 0 8192 1 2 : tunables 8 4 0 : slabdata 0 0 0 size-8192 18 18 8192 1 2 : tunables 8 4 0 : slabdata 18 18 0 size-4096(DMA) 0 0 4096 1 1 : tunables 24 12 8 : slabdata 0 0 0 size-4096 135 136 4096 1 1 : tunables 24 12 8 : slabdata 135 136 0 size-2048(DMA) 0 0 2048 2 1 : tunables 24 12 8 : slabdata 0 0 0 size-2048 632 650 2048 2 1 : tunables 24 12 8 : slabdata 325 325 6 size-1024(DMA) 0 0 1024 4 1 : tunables 54 27 8 : slabdata 0 0 0 size-1024 416 416 1024 4 1 : tunables 54 27 8 : slabdata 104 104 27 size-512(DMA) 0 0 512 8 1 : tunables 54 27 8 : slabdata 0 0 0 size-512 450 472 512 8 1 : tunables 54 27 8 : slabdata 59 59 0 size-256(DMA) 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0 size-256 1518 1545 256 15 1 : tunables 120 60 8 : slabdata 103 103 0 size-128(DMA) 0 0 128 30 1 : tunables 120 60 8 : slabdata 0 0 0 size-64(DMA) 0 0 64 59 1 : tunables 120 60 8 : slabdata 0 0 0 size-64 4281 7316 64 59 1 : tunables 120 60 8 : slabdata 124 124 0 size-32(DMA) 0 0 32 112 1 : tunables 120 60 8 : slabdata 0 0 0 size-128 1208 1350 128 30 1 : tunables 120 60 8 : slabdata 45 45 0 size-32 2023 2240 32 112 1 : tunables 120 60 8 : slabdata 20 20 0 kmem_cache 141 144 896 4 1 : tunables 54 27 8 : slabdata 36 36 0