Re: When will ZFS become stable?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Vadim Goncharov <vadim_nuclight@...>
Cc: <freebsd-current@...>
Date: Monday, January 7, 2008 - 11:39 am

On Mon, 7 Jan 2008, Vadim Goncharov wrote:


Did you have any luck raising interest from Paulo regarding this problem?  Is 
there a PR I can take a look at?  I'm not really familiar with the code, so 
I'd prefer someone who was a bit more familiar with it looked after it, but I 
can certainly take a glance.


This is a bit complicated to answer, but I'll try to capture the gist in a 
short space.

The kernel memory map is an address space in which pages can be placed to be 
used by the kernel.  Those pages are often allocated using one of two kernel 
allocators, malloc(9) which does variable sized memory allocations, and uma(9) 
which is a slab allocator and supports caching of complex but fixed-size 
objects.  Temporary buffers of variable size or infrequently allocated objects 
will use malloc, but frequently allocated objects of fixed size (vnods, mbufs, 
...) will use uma.  "vmstat -m" prints out information on malloc allocations, 
and "vmstat -z" prints out information on uma allocations.

To make life slightly more complicated, small malloc allocations are actually 
implemented using uma -- there are a small number of small object size zones 
reserved for this purpose, and malloc just rounds up to the next such bucket 
size and allocations from that bucket.  For larger sizes, malloc goes through 
uma, but pretty much directly to VM which makes pages available directly.  So 
when you look at "vmstat -z" output, be aware that some of the information 
presented there (zones named things like "128", "256", etc) are actually the 
pools from which malloc allocations come, so there's double-counting.

There are also other ways to get memory into the kernel map, such as directly 
inserting pages from user memory into the kernel address space in order to 
implement zero-copy.  This is done, for example, when zero-copy sockets are 
used.

To make life just very slightly more complicated even, I'll tell you that 
there are something called "submaps" in the kernel memory map, which have 
special properties.  One of these is used for mapping the buffer cache. 
Another is used for mapping pageable memory used as part of copy-reduction in 
the pipe(2) code.  Rather than copying twice (into the kernel and out again) 
in the pipe code, for large pipe I/O we will borrow the user pages from the 
sending process, mapping them into the kernel and hooking them up to the pipe.


The concept of kernel memory, as seen above, is a bit of a convoluted concept. 
Simple memory allocated by the kernel for its internal data structures, such 
as vnodes, sockets, mbufs, etc, is almost always not something that can be 
paged, as it may be accessed from contexts where blocking on I/O is not 
permitted (for example, in interrupt threads or with critical mutexes held). 
However, other memory in the kernel map may well be pageable, such as kernel 
thread stacks for sleeping user threads (which can be swapped out under heavy 
memory load), pipe buffers, and general cached data for the buffer cache / 
file system, which will be paged out or discarded when memory pressure goes 
up.

When debugging a kernel memory leak in the network stack, the usual starting 
point is to look at vmstat -m and vmstat -z to see what type of memory is 
being leaked.  The really big monotonically growing type is usually the one 
that's at fault.  Often it's the one being allocated when the system runs out 
of address space or memory, so sometimes even a simple backtrace will identify 
the culprit.

Robert N M Watson
Computer Laboratory
University of Cambridge
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
When will ZFS become stable?, Ivan Voras, (Fri Jan 4, 7:42 am)
Re: When will ZFS become stable?, Dag-Erling Smørgrav, (Mon Jan 7, 10:04 am)
Re: When will ZFS become stable?, Ivan Voras, (Mon Jan 7, 10:37 am)
Re: When will ZFS become stable?, Andrew Thompson, (Mon Jan 7, 4:46 pm)
Re: When will ZFS become stable?, Pawel Jakub Dawidek, (Mon Jan 7, 5:59 am)
Re: When will ZFS become stable?, Ivan Voras, (Mon Jan 7, 6:30 am)
Re: When will ZFS become stable?, Oliver Fromme, (Tue Jan 8, 1:58 pm)
Re: When will ZFS become stable?, Mark Powell, (Sat Jan 12, 5:45 pm)
Re: When will ZFS become stable?, Dag-Erling Smørgrav, (Tue Jan 8, 2:24 pm)
Re: When will ZFS become stable?, Scot Hetzel, (Wed Jan 9, 1:39 pm)
Re: When will ZFS become stable?, Ivan Voras, (Tue Jan 8, 7:16 pm)
Re: When will ZFS become stable?, Dan Nelson, (Wed Jan 9, 1:45 am)
Re: When will ZFS become stable?, Steve Kargl, (Tue Jan 8, 1:59 pm)
Re: When will ZFS become stable?, Igor Mozolevsky, (Mon Jan 7, 9:17 am)
Re: When will ZFS become stable?, Robert Watson, (Sun Jan 6, 11:36 am)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 12:47 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 1:20 pm)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 1:36 pm)
Re: When will ZFS become stable?, Claus Guttesen, (Sun Jan 6, 4:00 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 2:10 pm)
ZFS honesty, Scott Long, (Sun Jan 6, 5:00 pm)
Re: ZFS honesty, 韓家標 Bill Hacker, (Sun Jan 6, 6:20 pm)
Re: ZFS honesty, Ivan Voras, (Sun Jan 6, 6:43 pm)
Re: ZFS honesty, 韓家標 Bill Hacker, (Sun Jan 6, 6:58 pm)
Re: ZFS honesty, Alexandre "Sunny" Kovalenko..., (Sun Jan 6, 8:03 pm)
Re: ZFS honesty, 韓家標 Bill Hacker, (Sun Jan 6, 10:29 pm)
Re: ZFS honesty, Andrew Gallatin, (Wed Jan 9, 9:23 am)
Re: ZFS honesty, Alexandre "Sunny" Kovalenko..., (Wed Jan 9, 10:55 am)
Re: ZFS honesty, Andrew Gallatin, (Wed Jan 9, 11:36 am)
Re: ZFS honesty, Alexandre Biancalana, (Mon Jan 7, 11:23 am)
Re: ZFS honesty, Kris Kennaway, (Sun Jan 6, 5:32 pm)
Re: ZFS honesty, Scott Long, (Sun Jan 6, 5:54 pm)
Re: ZFS honesty, Ivan Voras, (Sun Jan 6, 6:33 pm)
Re: ZFS honesty, Ivan Voras, (Sun Jan 6, 9:16 pm)
Re: ZFS honesty, 韓家標 Bill Hacker, (Sun Jan 6, 6:32 pm)
Re: When will ZFS become stable?, Robert Watson, (Sun Jan 6, 1:08 pm)
Re: When will ZFS become stable?, Darren Reed, (Tue Jan 22, 11:09 am)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 1:28 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 1:43 pm)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 2:00 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 2:09 pm)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 2:49 pm)
Re: When will ZFS become stable?, Brooks Davis, (Fri Jan 4, 12:33 pm)
Re: When will ZFS become stable?, Ivan Voras, (Fri Jan 4, 1:58 pm)
Re: When will ZFS become stable?, Peter Schuller, (Sun Jan 6, 5:51 am)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 8:58 am)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 9:07 am)
Re: When will ZFS become stable?, Henri Hennebert, (Sun Jan 6, 11:48 am)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 12:03 pm)
Re: When will ZFS become stable?, Henri Hennebert, (Sun Jan 6, 12:47 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 1:13 pm)
Re: When will ZFS become stable?, Maciej Suszko, (Sun Jan 6, 9:46 am)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 11:46 am)
Re: When will ZFS become stable?, Maciej Suszko, (Sun Jan 6, 12:05 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 12:22 pm)
Re: When will ZFS become stable?, Maciej Suszko, (Sun Jan 6, 3:56 pm)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 9:50 am)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 10:27 am)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 10:51 am)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 11:08 am)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 12:45 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 1:12 pm)
Re: When will ZFS become stable?, Gary Corcoran, (Sun Jan 6, 2:48 pm)
Should we simply disallow ZFS on FreeBSD/i386?, Maxim Sobolev, (Sun Jan 6, 5:56 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Joao Barros, (Mon Jan 7, 10:52 am)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Peter Schuller, (Mon Jan 7, 1:06 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Alexander Kabaev, (Mon Jan 7, 6:47 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Christian Walther, (Mon Jan 7, 3:10 am)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Igor Mozolevsky, (Mon Jan 7, 4:20 am)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Christian Walther, (Mon Jan 7, 4:51 am)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Erich Dollansky, (Sun Jan 6, 7:39 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Oliver Fromme, (Tue Jan 8, 1:51 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Adam McDougall, (Sun Jan 6, 7:32 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, David Taylor, (Tue Jan 8, 3:56 am)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Maxim Sobolev, (Sun Jan 6, 8:58 pm)
Re: Should we simply disallow ZFS on FreeBSD/i386?, Bernd Walter, (Mon Jan 7, 11:36 am)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 1:20 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 1:34 pm)
Re: When will ZFS become stable?, Vadim Goncharov, (Sun Jan 6, 4:56 pm)
Re: When will ZFS become stable?, Kris Kennaway, (Sun Jan 6, 5:42 pm)
Re: When will ZFS become stable?, Robert Watson, (Sun Jan 6, 6:33 pm)
Re: When will ZFS become stable?, Vadim Goncharov, (Mon Jan 7, 11:16 am)
Re: When will ZFS become stable?, Robert Watson, (Mon Jan 7, 11:39 am)
Re: When will ZFS become stable?, Vadim Goncharov, (Mon Jan 7, 7:28 pm)
Re: When will ZFS become stable?, Robert Watson, (Mon Jan 7, 7:39 pm)
Re: When will ZFS become stable?, Vadim Goncharov, (Tue Jan 8, 2:58 pm)
Re: When will ZFS become stable?, Robert Watson, (Tue Jan 8, 3:22 pm)
Re: When will ZFS become stable?, Ivan Voras, (Sun Jan 6, 6:45 pm)
Re: When will ZFS become stable?, Robert Watson, (Tue Jan 8, 5:19 am)
Re: When will ZFS become stable?, Brooks Davis, (Fri Jan 4, 2:12 pm)